Repository: camel Updated Branches: refs/heads/camel-2.12.x 6224f46a4 -> 562992a13 refs/heads/camel-2.13.x 5eeb25e11 -> cfbf0a390
CAMEL-6716 Fixed the issue of ServiceInterfaceStrategy fails to create with interface containing multiple methods without parameters with thanks to Andrea Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b63f9e45 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b63f9e45 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b63f9e45 Branch: refs/heads/camel-2.13.x Commit: b63f9e450ee08defae09a788034aa82c61ea348f Parents: 5eeb25e Author: Willem Jiang <willem.ji...@gmail.com> Authored: Tue May 13 15:06:36 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Tue May 13 20:42:09 2014 +0800 ---------------------------------------------------------------------- .../soap/name/ServiceInterfaceStrategy.java | 16 ++++++----- .../soap/name/ServiceInterfaceStrategyTest.java | 4 +++ .../dataformat/soap/CustomerServiceImpl.java | 13 +++++++++ .../camel/dataformat/soap/CustomerService.wsdl | 28 ++++++++++++++++++++ 4 files changed, 54 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b63f9e45/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/ServiceInterfaceStrategy.java ---------------------------------------------------------------------- diff --git a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/ServiceInterfaceStrategy.java b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/ServiceInterfaceStrategy.java index b18f909..a860d56 100644 --- a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/ServiceInterfaceStrategy.java +++ b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/ServiceInterfaceStrategy.java @@ -158,13 +158,15 @@ public class ServiceInterfaceStrategy implements ElementNameStrategy { MethodInfo info = analyzeMethod(method); for (int i = 0; i < info.getIn().length; i++) { TypeInfo ti = info.getIn()[i]; - if (inTypeNameToQName.containsKey(ti.getTypeName()) - && (!(ti.getTypeName().equals("javax.xml.ws.Holder"))) - && (!(inTypeNameToQName.get(ti.getTypeName()).equals(ti.getElName())))) { - LOG.warn("Ambiguous QName mapping. The type [ " - + ti.getTypeName() - + " ] is already mapped to a QName in this context."); - continue; + if (inTypeNameToQName.containsKey(ti.getTypeName())) { + if (ti.getTypeName() != null) { + if (!(ti.getTypeName().equals("javax.xml.ws.Holder")) + && (!(inTypeNameToQName.get(ti.getTypeName()).equals(ti.getElName())))) { + LOG.warn("Ambiguous QName mapping. The type [ " + ti.getTypeName() + + " ] is already mapped to a QName in this context."); + continue; + } + } } inTypeNameToQName.put(ti.getTypeName(), ti.getElName()); } http://git-wip-us.apache.org/repos/asf/camel/blob/b63f9e45/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategyTest.java ---------------------------------------------------------------------- diff --git a/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategyTest.java b/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategyTest.java index 8c19a99..e14e24f 100644 --- a/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategyTest.java +++ b/components/camel-soap/src/test/java/org/apache/camel/converter/soap/name/ServiceInterfaceStrategyTest.java @@ -50,6 +50,10 @@ public class ServiceInterfaceStrategyTest extends Assert { QName elName3 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getAllCustomers", null); assertNull(elName3); + + QName elName4 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getAllAmericanCustomers", + null); + assertNull(elName4); try { elName = strategy.findQNameForSoapActionOrType("test", Class.class); http://git-wip-us.apache.org/repos/asf/camel/blob/b63f9e45/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/CustomerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/CustomerServiceImpl.java b/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/CustomerServiceImpl.java index 0c1f7f8..c9c3d92 100644 --- a/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/CustomerServiceImpl.java +++ b/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/CustomerServiceImpl.java @@ -18,6 +18,7 @@ package org.apache.camel.dataformat.soap; import com.example.customerservice.Customer; import com.example.customerservice.CustomerService; +import com.example.customerservice.GetAllAmericanCustomersResponse; import com.example.customerservice.GetAllCustomersResponse; import com.example.customerservice.GetCustomersByName; import com.example.customerservice.GetCustomersByNameResponse; @@ -70,6 +71,18 @@ public class CustomerServiceImpl implements CustomerService { response.getReturn().add(customer); return response; } + + /** + * This method is to test a call without input parameter + */ + public GetAllAmericanCustomersResponse getAllAmericanCustomers() { + GetAllAmericanCustomersResponse response = new GetAllAmericanCustomersResponse(); + Customer customer = new Customer(); + customer.setName("Schmitz"); + customer.setRevenue(100000); + response.getReturn().add(customer); + return response; + } public void saveCustomer(SaveCustomer request) { lastSavedCustomer = request.getCustomer(); http://git-wip-us.apache.org/repos/asf/camel/blob/b63f9e45/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.wsdl ---------------------------------------------------------------------- diff --git a/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.wsdl b/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.wsdl index a1423de..3973389 100644 --- a/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.wsdl +++ b/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/CustomerService.wsdl @@ -73,6 +73,18 @@ minOccurs="0"></xs:element> </xs:sequence> </xs:complexType> + + <xs:element name="getAllAmericanCustomers"> + </xs:element> + <xs:element name="getAllAmericanCustomersResponse" type="tns:getAllAmericanCustomersResponse"> + </xs:element> + + <xs:complexType name="getAllAmericanCustomersResponse"> + <xs:sequence> + <xs:element name="return" type="tns:customer" maxOccurs="unbounded" + minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> <xs:element name="saveCustomer" type="tns:saveCustomer"> </xs:element> @@ -100,7 +112,12 @@ </wsdl:message> <wsdl:message name="getAllCustomersResponse"> <wsdl:part name="parameters" element="tns:getAllCustomersResponse"></wsdl:part> + </wsdl:message> + <wsdl:message name="getAllAmericanCustomers"> </wsdl:message> + <wsdl:message name="getAllAmericanCustomersResponse"> + <wsdl:part name="parameters" element="tns:getAllAmericanCustomersResponse"></wsdl:part> + </wsdl:message> <wsdl:message name="saveCustomerRequest"> <wsdl:part name="parameters" element="tns:saveCustomer"></wsdl:part> </wsdl:message> @@ -119,6 +136,10 @@ <wsdl:input message="tns:getAllCustomers"></wsdl:input> <wsdl:output message="tns:getAllCustomersResponse"></wsdl:output> </wsdl:operation> + <wsdl:operation name="getAllAmericanCustomers"> + <wsdl:input message="tns:getAllAmericanCustomers"></wsdl:input> + <wsdl:output message="tns:getAllAmericanCustomersResponse"></wsdl:output> + </wsdl:operation> <wsdl:operation name="saveCustomer"> <wsdl:input message="tns:saveCustomerRequest"></wsdl:input> <wsdl:output message="tns:saveCustomerResponse"></wsdl:output> @@ -152,6 +173,12 @@ <soap:body use="literal" /> </wsdl:output> </wsdl:operation> + <wsdl:operation name="getAllAmericanCustomers"> + <soap:operation soapAction="http://customerservice.example.com/getAllAmericanCustomers" /> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> <wsdl:operation name="saveCustomer"> <soap:operation soapAction="http://customerservice.example.com/saveCustomer" /> <wsdl:input> @@ -168,3 +195,4 @@ </wsdl:port> </wsdl:service> </wsdl:definitions> +