tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r689587 - in /tuscany/java/sca: itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/ modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/ modules/core-databinding/src...
Date Wed, 27 Aug 2008 19:37:33 GMT
Author: rfeng
Date: Wed Aug 27 12:37:32 2008
New Revision: 689587

URL: http://svn.apache.org/viewvc?rev=689587&view=rev
Log:
Fix for TUSCANY-2398

Modified:
    tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
    tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
    tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
    tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
    tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
    tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
    tuscany/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java

Modified: tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
(original)
+++ tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
Wed Aug 27 12:37:32 2008
@@ -24,7 +24,6 @@
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -57,7 +56,7 @@
         }
     }
 
-    @Ignore("TUSCANY-2398")
+    // @Ignore("TUSCANY-2398")
     @Test
     public void testDocLitBareWsdl() throws Exception {
         AClientService client = domain.getService(AClientService.class, "AClientComponent");

Modified: tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
(original)
+++ tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
Wed Aug 27 12:37:32 2008
@@ -284,6 +284,10 @@
             javax.wsdl.Operation operation = generateOperation(definition, op, helpers, wrappers);
             portType.addOperation(operation);
             String action = ((JavaOperation)op).getAction();
+            if ((action == null || "".equals(action)) && !op.isWrapperStyle() &&
op.getWrapper() == null) {
+                // Bare style
+                action = "urn:" + op.getName();
+            }
             BindingOperation bindingOp = definitionGenerator.createBindingOperation(definition,
operation, action);
             binding.addBindingOperation(bindingOp);
         }
@@ -355,7 +359,25 @@
                 if (entry.getValue().size() == 1 && entry.getValue().get(0).getQName()
== null) {
                     // special case for global fault element
                     QName typeName = entry.getValue().get(0).getType().getQName();
-                    wrapper.setAttribute("type", typeName.getLocalPart());
+                    String nsURI = typeName.getNamespaceURI();
+                    if ("".equals(nsURI)) {
+                        wrapper.setAttribute("type", typeName.getLocalPart());
+                        addSchemaImport(schema, "", schemaDoc);
+                    } else if (targetNS.equals(nsURI)) {
+                        wrapper.setAttribute("type", typeName.getLocalPart());
+                    } else if (SCHEMA_NS.equals(nsURI)) {
+                        wrapper.setAttribute("type", "xs:" + typeName.getLocalPart());
+                    } else {
+                        Map<String, String> prefixMap = prefixMaps.get(schema);
+                        String prefix = prefixMap.get(nsURI);
+                        if (prefix == null) {
+                            prefix = "ns" + i++;
+                            prefixMap.put(nsURI, prefix);
+                            schema.setAttributeNS(XMLNS_NS, "xmlns:" + prefix, nsURI);
+                            addSchemaImport(schema, nsURI, schemaDoc);
+                        }
+                        wrapper.setAttribute("type", prefix + ":" + typeName.getLocalPart());
+                    }                    
                 } else {
                     // normal wrapper containing type definition inline
                     Element complexType = schemaDoc.createElementNS(SCHEMA_NS, "xs:complexType");
@@ -544,6 +566,7 @@
         inputMsg.setUndefined(false);
         definition.addMessage(inputMsg);
 
+        List<ElementInfo> elements = null;
         // FIXME: By default, java interface is mapped to doc-lit-wrapper style WSDL
         if (op.getWrapper() != null) {
             // Generate doc-lit-wrapper style
@@ -553,6 +576,11 @@
             int i = 0;
             for (DataType d : op.getInputType().getLogical()) {
                 inputMsg.addPart(generatePart(definition, d, "arg" + i));
+                elements = new ArrayList<ElementInfo>();
+                ElementInfo element = getElementInfo(d.getPhysical(), d, null, helpers);
+                elements.add(element);
+                QName elementName = ((XMLType)d.getLogical()).getElementName();
+                wrappers.put(elementName, elements);
                 i++;
             }
         }
@@ -570,7 +598,15 @@
             if (op.getWrapper() != null) {
                 outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers,
false));
             } else {
-                outputMsg.addPart(generatePart(definition, op.getOutputType(), "return"));
+                DataType outputType = op.getOutputType();
+                outputMsg.addPart(generatePart(definition, outputType, "return"));
+                if (outputType != null) {
+                    elements = new ArrayList<ElementInfo>();
+                    ElementInfo element = getElementInfo(outputType.getPhysical(), outputType,
null, helpers);
+                    elements.add(element);
+                    QName elementName = ((XMLType)outputType.getLogical()).getElementName();
+                    wrappers.put(elementName, elements);
+                }
             }
             output.setMessage(outputMsg);
 
@@ -594,17 +630,16 @@
             }
             fault.setMessage(faultMsg);
             operation.addFault(fault);
-            List<ElementInfo> elements = null;
             if (faultType.getLogical().getPhysical() != faultType.getPhysical()) {
                 // create special wrapper for type indirection to real fault bean
-                elements = new ArrayList<ElementInfo>(1);
                 DataType logical = faultType.getLogical();
+                elements = new ArrayList<ElementInfo>();
                 elements.add(getElementInfo(logical.getPhysical(), logical, null, helpers));
              } else {
                 // convert synthesized fault bean to a wrapper type
-                elements = new ArrayList<ElementInfo>();
                 for (DataType<XMLType> propDT: op.getFaultBeans().get(faultName)) {
                     XMLType logical = propDT.getLogical();
+                    elements = new ArrayList<ElementInfo>();
                     elements.add(getElementInfo(propDT.getPhysical(), propDT, logical.getElementName(),
helpers));
                 }
             }

Modified: tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
(original)
+++ tuscany/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
Wed Aug 27 12:37:32 2008
@@ -146,7 +146,8 @@
         try {
             for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) {
                 Operation operation = (Operation)oi.next();
-                BindingOperation bindingOperation = createBindingOperation(definition, operation,
"");
+                BindingOperation bindingOperation =
+                    createBindingOperation(definition, operation, "urn:" + operation.getName());
                 binding.addBindingOperation(bindingOperation);
             }
         } catch (WSDLException e) {

Modified: tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
(original)
+++ tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
Wed Aug 27 12:37:32 2008
@@ -133,7 +133,8 @@
         // Check if the source operation is wrapped
         DataType<List<DataType>> sourceType = context.getSourceDataType();
         Operation sourceOp = context.getSourceOperation();
-        boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+        boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle() &&
sourceOp.getWrapper() != null;
+        boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() &&
sourceOp.getWrapper() == null;
 
         // Find the wrapper handler for source data
         WrapperHandler sourceWrapperHandler = null;
@@ -143,19 +144,20 @@
         // Check if the target operation is wrapped
         DataType<List<DataType>> targetType = context.getTargetDataType();
         Operation targetOp = (Operation)context.getTargetOperation();
-        boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
+        boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() &&
targetOp.getWrapper() != null;
+        boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() &&
targetOp.getWrapper() == null;
 
         // Find the wrapper handler for target data
         WrapperHandler targetWrapperHandler = null;
         String targetDataBinding = getDataBinding(targetOp);
         targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
 
-        if ((!sourceWrapped) && targetWrapped) {
+        if ((!sourceWrapped && !sourceBare) && targetWrapped) {
             // Unwrapped --> Wrapped
             WrapperInfo wrapper = targetOp.getWrapper();
-            ElementInfo wrapperElement = wrapper.getInputWrapperElement();
+            // ElementInfo wrapperElement = wrapper.getInputWrapperElement();
 
-            Class<?> targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass()
: null;
+            // Class<?> targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass()
: null;
 
             if (source == null) {
                 // Empty child elements
@@ -207,14 +209,14 @@
                                              true);
             return new Object[] {targetWrapper};
 
-        } else if (sourceWrapped && (!targetWrapped)) {
+        } else if (sourceWrapped && (!targetWrapped && !targetBare)) {
             // Wrapped to Unwrapped
             Object sourceWrapper = source[0];
             Object[] target = null;
 
-            List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
+            // List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
             if (targetWrapperHandler != null) {
-                ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
+                // ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
                 // FIXME: This is a workaround for the wsdless support as it passes in child
elements
                 // under the wrapper that only matches by position
                 if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, true)) {

Modified: tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
(original)
+++ tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
Wed Aug 27 12:37:32 2008
@@ -154,7 +154,8 @@
         try {
             DataType<DataType> sourceType = context.getSourceDataType();
             Operation sourceOp = context.getSourceOperation();
-            boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+            boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle()
&& sourceOp.getWrapper() != null;
+            boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() &&
sourceOp.getWrapper() == null;
 
             WrapperHandler sourceWrapperHandler = null;
             String sourceDataBinding = getDataBinding(sourceOp);
@@ -162,12 +163,14 @@
 
             DataType<DataType> targetType = context.getTargetDataType();
             Operation targetOp = (Operation)context.getTargetOperation();
-            boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
+            boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle()
&& targetOp.getWrapper() != null;
+            boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() &&
targetOp.getWrapper() == null;
+
             WrapperHandler targetWrapperHandler = null;
             String targetDataBinding = getDataBinding(targetOp);
             targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
 
-            if ((!sourceWrapped) && targetWrapped) {
+            if ((!sourceWrapped &&!sourceBare) && targetWrapped) {
                 // Unwrapped --> Wrapped
                 WrapperInfo wrapper = targetOp.getWrapper();
                 ElementInfo wrapperElement = wrapper.getOutputWrapperElement();
@@ -211,7 +214,7 @@
                 child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata());
                 targetWrapperHandler.setChildren(targetWrapper, new Object[] {child}, targetOp,
false);
                 return targetWrapper;
-            } else if (sourceWrapped && (!targetWrapped)) {
+            } else if (sourceWrapped && (!targetWrapped && !targetBare))
{
                 // Wrapped to Unwrapped
                 Object sourceWrapper = response;
                 List<ElementInfo> childElements = sourceOp.getWrapper().getOutputChildElements();

Modified: tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
(original)
+++ tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
Wed Aug 27 12:37:32 2008
@@ -125,8 +125,11 @@
             boolean bare = false;
             if (methodSOAPBinding != null) {
                 bare = methodSOAPBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE;
-                // For BARE parameter style, the data is in the wrapped format already
-                operation.setWrapperStyle(bare);
+                if(bare) {
+                    // For BARE parameter style, the data won't be unwrapped
+                    // The wrapper should be null
+                    operation.setWrapperStyle(false);
+                }
                 documentStyle = methodSOAPBinding.style() == Style.DOCUMENT;
             }
 

Modified: tuscany/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java?rev=689587&r1=689586&r2=689587&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
(original)
+++ tuscany/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
Wed Aug 27 12:37:32 2008
@@ -36,7 +36,6 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 
 import com.example.stock.StockExceptionTest;
-
 /**
  *
  * @version $Rev$ $Date$
@@ -91,7 +90,7 @@
             op = op2;
         }
 
-        assertTrue(op.isWrapperStyle());
+        assertTrue(!op.isWrapperStyle() && op.getWrapper() == null);
 
         if ("M2".equals(op2.getName())) {
             op = op2;



Mime
View raw message