You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/05/28 05:11:14 UTC

svn commit: r542093 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/simple/src/main/java/org/apache/cxf/se...

Author: dkulp
Date: Sun May 27 20:11:14 2007
New Revision: 542093

URL: http://svn.apache.org/viewvc?view=rev&rev=542093
Log:
JWS allows Request/ResponseWrappers that point to schemas that don't meet the JAX-WS spec. (can have element refs) Add support for that.

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingOperationInfo.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingOperationInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingOperationInfo.java?view=diff&rev=542093&r1=542092&r2=542093
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingOperationInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingOperationInfo.java Sun May 27 20:11:14 2007
@@ -77,6 +77,12 @@
         opHolder = wrapped;
     }
 
+    public void updateUnwrappedOperation() {
+        if (opInfo.isUnwrappedCapable()
+            && opHolder == null) {
+            opHolder = new BindingOperationInfo(bindingInfo, opInfo.getUnwrappedOperation(), this);
+        }        
+    }
     
     public BindingInfo getBinding() {
         return bindingInfo;

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=542093&r1=542092&r2=542093
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Sun May 27 20:11:14 2007
@@ -598,10 +598,10 @@
             copyExtensors(finfo, entry.getValue().getExtensibilityElements());
             copyExtensionAttributes(finfo, entry.getValue());
         }
-        checkForWrapped(opInfo);
+        checkForWrapped(opInfo, false);
     }
 
-    private void checkForWrapped(OperationInfo opInfo) {
+    public static void checkForWrapped(OperationInfo opInfo, boolean allowRefs) {
         MessageInfo inputMessage = opInfo.getInput();
         MessageInfo outputMessage = opInfo.getOutput();
         boolean passedRule = true;
@@ -671,7 +671,8 @@
         if (inputEl.getSchemaType() instanceof XmlSchemaComplexType) {
             xsct = (XmlSchemaComplexType)inputEl.getSchemaType();
             if (hasAttributes(xsct)
-                || !isWrappableSequence(xsct, inputEl.getQName().getNamespaceURI(), unwrappedInput)) {
+                || !isWrappableSequence(xsct, inputEl.getQName().getNamespaceURI(),
+                                        unwrappedInput, allowRefs)) {
                 passedRule = false;
             }
         } else {
@@ -688,7 +689,8 @@
             if (outputEl != null && outputEl.getSchemaType() instanceof XmlSchemaComplexType) {
                 xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
                 if (hasAttributes(xsct)
-                    || !isWrappableSequence(xsct, outputEl.getQName().getNamespaceURI(), unwrappedOutput)) {
+                    || !isWrappableSequence(xsct, outputEl.getQName().getNamespaceURI(),
+                                            unwrappedOutput, allowRefs)) {
                     passedRule = false;
                 }
             } else {
@@ -707,7 +709,7 @@
         }
     }
 
-    private boolean hasAttributes(XmlSchemaComplexType complexType) {
+    private static boolean hasAttributes(XmlSchemaComplexType complexType) {
         // Now lets see if we have any attributes...
         // This should probably look at the restricted and substitute types too.
         if (complexType.getAnyAttribute() != null || complexType.getAttributes().getCount() > 0) {
@@ -716,7 +718,8 @@
         return false;
     }
 
-    private boolean isWrappableSequence(XmlSchemaComplexType type, String namespaceURI, MessageInfo wrapper) {
+    private static boolean isWrappableSequence(XmlSchemaComplexType type, String namespaceURI,
+                                        MessageInfo wrapper, boolean allowRefs) {
         if (type.getParticle() instanceof XmlSchemaSequence) {
             XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle();
             XmlSchemaObjectCollection items = seq.getItems();
@@ -738,7 +741,9 @@
                     mpi.setTypeQName(el.getRefName());
                     mpi.setXmlSchema(el);
                     //element reference is not permitted for wrapper element
-                    ret = false;
+                    if (!allowRefs) {
+                        ret = false;                        
+                    }
                 } else {
                     // anonymous type
                     MessagePartInfo mpi = wrapper.addMessagePart(new QName(namespaceURI, el.getName()));

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=542093&r1=542092&r2=542093
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Sun May 27 20:11:14 2007
@@ -151,7 +151,6 @@
     @Override
     protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method) {
         method = ((JaxWsServiceConfiguration)jaxWsConfiguration).getDeclaredMethod(method);
-
         super.initializeWSDLOperation(intf, o, method);
 
         initializeWrapping(o, method);
@@ -327,6 +326,13 @@
      */
     protected void initializeClassInfo(OperationInfo o, Method method, List<String> paramOrder) {
         if (isWrapped(method)) {
+            if (o.getUnwrappedOperation() == null) {
+                //the "normal" algorithm didn't allow for unwrapping,
+                //but the annotations say unwrap this.   We'll need to
+                //make it.
+                WSDLServiceBuilder.checkForWrapped(o, true);
+            }
+            
             if (o.hasInput()) {
                 MessageInfo input = o.getInput();
                 MessagePartInfo part = input.getMessageParts().get(0);                

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=542093&r1=542092&r2=542093
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Sun May 27 20:11:14 2007
@@ -59,6 +59,8 @@
 import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.invoker.LocalFactory;
 import org.apache.cxf.service.model.AbstractMessageContainer;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
@@ -301,6 +303,15 @@
             }
 
             initializeWSDLOperation(intf, o, selected);
+        }
+        
+        //Some of the operations may have switched from unwrapped to wrapped.  Update the bindings.
+        for (ServiceInfo service : getService().getServiceInfos()) {
+            for (BindingInfo bi : service.getBindings()) {
+                for (BindingOperationInfo binfo : bi.getOperations()) {
+                    binfo.updateUnwrappedOperation();
+                }
+            }
         }
     }