Author: dkulp
Date: Wed Oct 31 04:56:16 2007
New Revision: 590631

URL: http://svn.apache.org/viewvc?rev=590631&view=rev
Log:
Merged revisions 590451 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r590451 | dkulp | 2007-10-30 16:52:52 -0400 (Tue, 30 Oct 2007) | 2 lines
  
  CXF-940 - Allow services to work if they don't have methods for some of the 
operations in the wsdl.  The methods it does have will work.
........

Added:
    
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java
      - copied unchanged from r590451, 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceMissingOps.java
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
    
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
    
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
    
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java?rev=590631&r1=590630&r2=590631&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
 Wed Oct 31 04:56:16 2007
@@ -101,6 +101,20 @@
         
         operations.put(operation.getName(), operation);
     }
+    
+    /**
+     * Removes an operation from this service.
+     *
+     * @param operation the operation.
+     */
+    public void removeOperation(BindingOperationInfo operation) {
+        if (operation.getName() == null) {
+            throw new NullPointerException(
+                new Message("BINDING.OPERATION.NAME.NOT.NULL", 
LOG).toString());
+        } 
+        
+        operations.remove(operation.getName());
+    }
 
     /**
      * Returns the operation info with the given name, if found.

Modified: 
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java?rev=590631&r1=590630&r2=590631&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
 Wed Oct 31 04:56:16 2007
@@ -85,6 +85,15 @@
     void addOperation(OperationInfo operation) {
         operations.put(operation.getName(), operation);
     }
+    
+    /**
+     * Removes an operation from this service.
+     *
+     * @param operation the operation.
+     */
+    public void removeOperation(OperationInfo operation) {
+        operations.remove(operation.getName());
+    }    
 
     /**
      * Returns the operation info with the given name, if found.

Modified: 
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=590631&r1=590630&r2=590631&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
 Wed Oct 31 04:56:16 2007
@@ -294,6 +294,7 @@
     }
 
     protected void initializeWSDLOperations() {
+        List<OperationInfo> removes = new ArrayList<OperationInfo>();
         Method[] methods = serviceClass.getMethods();
         Arrays.sort(methods, new MethodComparator());
 
@@ -320,17 +321,29 @@
             }
 
             if (selected == null) {
-                throw new ServiceConstructionException(new 
Message("NO_METHOD_FOR_OP", LOG, o.getName()));
+                LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
+                removes.add(o);
+            } else {
+                initializeWSDLOperation(intf, o, selected);
             }
-
-            initializeWSDLOperation(intf, o, selected);
+        }
+        for (OperationInfo op : removes) {
+            intf.removeOperation(op);
         }
 
         //Some of the operations may have switched from unwrapped to wrapped.  
Update the bindings.
         for (ServiceInfo service : getService().getServiceInfos()) {
             for (BindingInfo bi : service.getBindings()) {
+                List<BindingOperationInfo> biremoves = new 
ArrayList<BindingOperationInfo>();
                 for (BindingOperationInfo binfo : bi.getOperations()) {
-                    binfo.updateUnwrappedOperation();
+                    if (removes.contains(binfo.getOperationInfo())) {
+                        biremoves.add(binfo); 
+                    } else {
+                        binfo.updateUnwrappedOperation();
+                    }
+                }
+                for (BindingOperationInfo binfo : biremoves) {
+                    bi.removeOperation(binfo);
                 }
             }
         }

Modified: 
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties?rev=590631&r1=590630&r2=590631&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
 Wed Oct 31 04:56:16 2007
@@ -19,7 +19,7 @@
 #
 #
 COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
-NO_METHOD_FOR_OP = Could not find a matching method for operation {0}
+NO_METHOD_FOR_OP = Could not find a matching method for operation {0}. 
Operation will be unavailable.
 COULD_NOT_SET_WRAPPER_STYLE = Service class: {0} contains overloaded operation 
can not use wrapper style
 USING_PROXY_FOR_SERVICE = Service class: {0} is a java.lang.reflect.Proxy 
instance.  This is known not to work well as \
   annotations on the real instance are not available.  We suggest overriding 
the ServiceClass via spring config or \

Modified: 
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=590631&r1=590630&r2=590631&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
 Wed Oct 31 04:56:16 2007
@@ -198,6 +198,23 @@
     }
     
     @Test
+    public void testMissingMethods() throws Exception {
+        QName portName = new 
QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService";, 
+                "DocLitWrappedCodeFirstServicePort");
+        QName servName = new 
QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService";, 
+                "DocLitWrappedCodeFirstService");
+        
+        Service service = Service.create(new 
URL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl"),
+                      servName);
+        DocLitWrappedCodeFirstServiceMissingOps port = 
service.getPort(portName,
+                                  
DocLitWrappedCodeFirstServiceMissingOps.class);
+
+        int[] ret = port.echoIntArray(new int[] {1, 2});
+        assertNotNull(ret);
+        //port.arrayOutput();
+    }
+    
+    @Test
     public void testStringListOutDocLitNoWsdl() throws Exception {
         QName portName = new 
QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService";, 
                                    "DocLitWrappedCodeFirstServicePort");


Reply via email to