From f46dc97c15a4b8fd0a58a96a4f7080ae8648c0a8 Mon Sep 17 00:00:00 2001 From: scottkurz Date: Thu, 23 Feb 2012 18:58:30 +0000 Subject: Fix for TUSCANY-3824. Thanks Greg. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1292896 13f79535-47bb-0310-9956-ffa450edef68 --- .../ws/wsdlgen/Interface2WSDLGenerator.java | 7 ++-- .../ws/wsdlgen/WSDLDefinitionGenerator.java | 6 ++- .../java/jaxws/JAXWSJavaInterfaceProcessor.java | 47 +++++++++++++--------- 3 files changed, 36 insertions(+), 24 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java index 1824e27f98..c20ffd7c43 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java +++ b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java @@ -360,9 +360,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.isInputWrapperStyle() && op.getInputWrapper() == null) { - // Bare style - action = "urn:" + op.getName(); + // Removed improper defaulting of SOAP action when using doc/lit BARE. + // The correct default is "" (empty string). + if (action == null) { + action = ""; } BindingOperation bindingOp = definitionGenerator.createBindingOperation(definition, operation, action); binding.addBindingOperation(bindingOp); diff --git a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java index 5308b3c0e7..6edd4dc86a 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java +++ b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java @@ -161,8 +161,12 @@ public class WSDLDefinitionGenerator { try { for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) { Operation operation = (Operation)oi.next(); + // Removed improper defaulting of SOAP action. createBindingOperations() is called + // when binding.ws does not supply a WSDL binding and the reference is using interface.wsdl. + // In this case there is no source for a user-supplied action. + // The correct default is "" (empty string). BindingOperation bindingOperation = - createBindingOperation(definition, operation, "urn:" + operation.getName()); + createBindingOperation(definition, operation, ""); binding.addBindingOperation(bindingOperation); } } catch (WSDLException e) { diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java index 3fc646cdfa..2e6b19b451 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java @@ -175,33 +175,40 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { // Handle BARE mapping if (bare) { for (int i = 0; i < method.getParameterTypes().length; i++) { + String ns = tns; + // Default to for doc-bare + String name = (documentStyle ? operationName : "arg" + i); WebParam param = getAnnotation(method, i, WebParam.class); if (param != null) { - String ns = getValue(param.targetNamespace(), tns); - // Default to for doc-bare - String name = getValue(param.name(), documentStyle ? operationName : "arg" + i); - QName element = new QName(ns, name); - Object logical = operation.getInputType().getLogical().get(i).getLogical(); - if (logical instanceof XMLType) { - ((XMLType)logical).setElementName(element); - } + if (!"".equals(param.targetNamespace())) + ns = param.targetNamespace(); + if (!"".equals(param.name())) + name = param.name(); operation.getParameterModes().set(i, getParameterMode(param.mode())); } - ParameterMode mode = operation.getParameterModes().get(i); + QName element = new QName(ns, name); + Object logical = operation.getInputType().getLogical().get(i).getLogical(); + if (logical instanceof XMLType) { + ((XMLType)logical).setElementName(element); + } } - - WebResult result = method.getAnnotation(WebResult.class); - if (result != null) { - String ns = getValue(result.targetNamespace(), tns); + + if (!operation.hasReturnTypeVoid()) { + String ns = tns; // Default to Response for doc-bare - String name = getValue(result.name(), documentStyle ? operationName + "Response" : "return"); + String name = (documentStyle ? operationName + "Response" : "return"); + WebResult result = method.getAnnotation(WebResult.class); + if (result != null) { + if (!"".equals(result.targetNamespace())) + ns = result.targetNamespace(); + if (!"".equals(result.name())) + name = result.name(); + } QName element = new QName(ns, name); - if (!operation.hasReturnTypeVoid()) { - List outputDataTypes = operation.getOutputType().getLogical(); - DataType returnDataType = outputDataTypes.get(0); - if (returnDataType instanceof XMLType) { - ((XMLType)returnDataType).setElementName(element); - } + List outputDataTypes = operation.getOutputType().getLogical(); + DataType returnDataType = outputDataTypes.get(0); + if (returnDataType instanceof XMLType) { + ((XMLType)returnDataType).setElementName(element); } } // Rather than relying on null wrapper, we use a flag with a clearer meaning. -- cgit v1.2.3