summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java3
-rw-r--r--java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java45
-rw-r--r--java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java3
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java18
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java11
-rw-r--r--java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java7
-rw-r--r--java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java3
7 files changed, 66 insertions, 24 deletions
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java b/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
index 7475df21a7..744bf20494 100644
--- a/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
@@ -24,7 +24,6 @@ import junit.framework.Assert;
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 @@ public class DocLitBareWsdlTestCase {
}
}
- @Ignore("TUSCANY-2398")
+ // @Ignore("TUSCANY-2398")
@Test
public void testDocLitBareWsdl() throws Exception {
AClientService client = domain.getService(AClientService.class, "AClientComponent");
diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
index d908819bc8..29b354810a 100644
--- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
@@ -284,6 +284,10 @@ public class Interface2WSDLGenerator {
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 @@ public class Interface2WSDLGenerator {
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 @@ public class Interface2WSDLGenerator {
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 @@ public class Interface2WSDLGenerator {
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 @@ public class Interface2WSDLGenerator {
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 @@ public class Interface2WSDLGenerator {
}
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));
}
}
diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
index f99947a52e..d0b79f9b0e 100644
--- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
+++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
@@ -146,7 +146,8 @@ public class WSDLDefinitionGenerator {
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) {
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
index 71694c0a0a..fb5f939edb 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
@@ -133,7 +133,8 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]>
// 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 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]>
// 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 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]>
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)) {
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
index 71253f00b4..8d586905c4 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
@@ -154,7 +154,8 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im
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 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im
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 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im
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();
diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
index f779e04258..d1b36fa17c 100644
--- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
+++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
@@ -125,8 +125,11 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
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;
}
diff --git a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
index cdfac400e2..108d283584 100644
--- a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
+++ b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
@@ -36,7 +36,6 @@ import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import com.example.stock.StockExceptionTest;
-
/**
*
* @version $Rev$ $Date$
@@ -91,7 +90,7 @@ public class JAXWSJavaInterfaceProcessorTestCase extends TestCase {
op = op2;
}
- assertTrue(op.isWrapperStyle());
+ assertTrue(!op.isWrapperStyle() && op.getWrapper() == null);
if ("M2".equals(op2.getName())) {
op = op2;