I am using wsimport to generate client java code from two wsdl files, here are the two wsdl.
file1.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="
http://service.metro.ws.com/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns="
http://schemas.xmlsoap.org/wsdl/"
targetNamespace="
http://service.metro.ws.com/"
name="HelloService"
>
<types>
<xs:schema xmlns:hr="
http://service.metro.ws.com/"
xmlns:xs="
http://www.w3.org/2001/XMLSchema" targetNamespace="
http://service.metro.ws.com/"
version="1.0">
<xs:element name="hello" type="hr:hello" />
<xs:element name="helloResponse" type="hr:helloResponse" />
<xs:complexType name="hello">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="helloResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="hello">
<part name="parameters" element="tns:hello" />
</message>
<message name="helloResponse">
<part name="parameters" element="tns:helloResponse" />
</message>
<portType name="Hello">
<operation name="hello">
<input message="tns:hello" />
<output message="tns:helloResponse" />
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="
http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="hello">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="
http://localhost:8081/metro/service/hello" />
</port>
</service>
</definitions>
file2.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="
http://service.spring.ws.com/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns="
http://schemas.xmlsoap.org/wsdl/"
targetNamespace="
http://service.spring.ws.com/"
name="HelloService">
<types>
<xs:schema xmlns:hr="
http://service.spring.ws.com/"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://service.spring.ws.com/"
version="1.0">
<!-- The convention for the name is <operation_name>Request -->
<xs:element name="helloRequest" type="hr:helloRequest" />
<!-- The convention for the name is <operation_name>Response -->
<xs:element name="helloResponse" type="hr:helloResponse" />
<xs:complexType name="helloRequest">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="helloResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="helloResponse">
<part element="tns:helloResponse" name="parameters">
</part>
</message>
<message name="helloRequest">
<part element="tns:helloRequest" name="parameters">
</part>
</message>
<portType name="Hello">
<operation name="hello">
<input message="tns:helloRequest">
</input>
<output message="tns:helloResponse">
</output>
</operation>
</portType>
<binding name="HelloBinding" type="tns:Hello">
<soap:binding style="document"
transport="
http://schemas.xmlsoap.org/soap/http" />
<operation name="hello">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="HelloService">
<port binding="tns:HelloBinding" name="HelloPort">
<soap:address location="
http://localhost:8081/spring/service/hello" />
</port>
</service>
</definitions>
They are almost the same except each have its own target namespace, and the names of input message are different: one is "hello" and another "helloRequest". The method generated by wsimport from file1.wsdl is:
public String hello(String arg0);
and another method generated from file2.wsdl is:
public HelloResponse hello(HelloRequest parameters);
I am expecting these two wsdl will generate exactly the same method signature for the operation hello. If I change the message name "helloRequest" in file2.wsdl to "hello", the generated signature will be the same. I am wondering whether there are some name conventions used by wsimport? It seems to me that the name should not affect the signature of the operation, or is this just a bug in wsimport?
Thanks
[Message sent by forum member 'yonghe' (yonghe)]
http://forums.java.net/jive/thread.jspa?messageID=358893