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 +++++++----- .../org/example/orderservice/OrderServiceBare.java | 88 +++++++++++----------- 4 files changed, 81 insertions(+), 67 deletions(-) (limited to 'sca-java-2.x/trunk') 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. diff --git a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceBare.java b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceBare.java index b607250806..ca05c28627 100644 --- a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceBare.java +++ b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceBare.java @@ -1,43 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.example.orderservice; - -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.ws.Holder; - -import org.oasisopen.sca.annotation.Remotable; - -@WebService -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface OrderServiceBare { - - public Order bareReviewOrder(Order order); - - public void bareReviewOrderInOutHolder( - @WebParam(mode = WebParam.Mode.INOUT) - Holder myData); - - public void bareReviewOrderOutHolder( - @WebParam(mode = WebParam.Mode.OUT) - Holder myData); - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.example.orderservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.xml.ws.Holder; + +import org.oasisopen.sca.annotation.Remotable; + +@WebService +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +public interface OrderServiceBare { + + public Order bareReviewOrder(Order order); + + public void bareReviewOrderInOutHolder( + @WebParam(mode = WebParam.Mode.INOUT) + Holder myData); + + @WebMethod(action = "bareReviewOrderOutHolder") + public void bareReviewOrderOutHolder( + @WebParam(mode = WebParam.Mode.OUT) + Holder myData); + +} -- cgit v1.2.3