Invalid WSDL (jsr-181)
still_aimless Apr 9, 2006 8:10 AMJBoss 4.0.4-CR2
base class:
package test.ws.a; public class BaseResponse {}
derived class (notice that it is in a different package):
package test.ws.b; import test.ws.a.BaseResponse; public class StandardResponse extends BaseResponse {}
package test.ws; import javax.jws.WebMethod; import javax.jws.WebResult; import javax.jws.WebService; import test.ws.b.StandardResponse; @WebService( name = "MyServiceInterface", serviceName = "MyService") public class MyService { @WebMethod public @WebResult StandardResponse foo() { return new StandardResponse(); } }
the tools generate the following WSDL (exposed via a servlet)
<definitions name='MyService' targetNamespace='http://ws.test/jaws' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns2='http://a.ws.test/jaws' xmlns:ns3='http://b.ws.test/jaws' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://ws.test/jaws' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <types> <schema elementFormDefault='qualified' targetNamespace='http://ws.test/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns2='http://a.ws.test/jaws' xmlns:ns3='http://b.ws.test/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://ws.test/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <import namespace='http://a.ws.test/jaws'/> <import namespace='http://b.ws.test/jaws'/> <complexType name='foo'> <sequence/> </complexType> <complexType name='fooResponse'> <sequence> <element name='return' nillable='true' type='ns3:StandardResponse'/> </sequence> </complexType> <element name='foo' type='tns:foo'/> <element name='fooResponse' type='tns:fooResponse'/> </schema> <schema elementFormDefault='qualified' targetNamespace='http://a.ws.test/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns1='http://ws.test/jaws' xmlns:ns3='http://b.ws.test/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://a.ws.test/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <import namespace='http://ws.test/jaws'/> <import namespace='http://b.ws.test/jaws'/> <complexType name='BaseResponse'> <sequence/> </complexType> </schema> <schema elementFormDefault='qualified' targetNamespace='http://b.ws.test/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns1='http://ws.test/jaws' xmlns:ns2='http://a.ws.test/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://b.ws.test/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <import namespace='http://ws.test/jaws'/> <import namespace='http://a.ws.test/jaws'/> <complexType name='StandardResponse'> <complexContent> <extension base='tns:BaseResponse'> <sequence/> </extension> </complexContent> </complexType> </schema> </types> <message name='MyServiceInterface_foo'> <part element='tns:foo' name='parameters'/> </message> <message name='MyServiceInterface_fooResponse'> <part element='tns:fooResponse' name='result'/> </message> <portType name='MyServiceInterface'> <operation name='foo'> <input message='tns:MyServiceInterface_foo'/> <output message='tns:MyServiceInterface_fooResponse'/> </operation> </portType> <binding name='MyServiceInterfaceBinding' type='tns:MyServiceInterface'> <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='foo'> <soap:operation soapAction=''/> <input> <soap:body use='literal'/> </input> <output> <soap:body use='literal'/> </output> </operation> </binding> <service name='MyService'> <port binding='tns:MyServiceInterfaceBinding' name='MyServiceInterfacePort'> <soap:address location='http://bender:8080/etlws/MyService'/> </port> </service> </definitions>
which is invalid because
<extension base='tns:BaseResponse'>
should really be
<extension base='ns2:BaseResponse'>
The only way to use the service as is, is dump all types into the same package.