1 Reply Latest reply on Jun 24, 2010 7:14 AM by jim.ma

    Invalid WSDL (JBOSS EAP 5.0 )

    nareshs

      NOTE: This issue is similar to previous discussion Invalid WSDL (jsr-181). But not the same

       

      Base Class

       

      {code}

      @XmlAccessorType(XmlAccessType.FIELD)

      @XmlType(name = "fooResponse", namespace = "http://a.ws.test/")

      public class BaseResponse {

       

            @XmlElement(required=true)

            private String hello;

       

            public String getHello() {

                  return hello;

            }

       

            public void setHello(String hello) {

                  this.hello = hello;

            }

      }

      {code}

       

      Standard Response Class

       

       

           {code}

      @XmlType(name = "fooResponse", namespace = "http://b.ws.test/")

      @XmlAccessorType(XmlAccessType.FIELD)

      public class StandardResponse extends BaseResponse {

       

      }

      {code}

       

       

      Fault Message

       

           

      {code}

      @WebFault(name="TestFaultMessage", targetNamespace="http://b.ws.test/")

      public class TestFaultMessage extends Exception {

       

      }

      {code}

       

      My Service

       

           

      {code}
            @WebService(endpointInterface="test.ws.MyServiceInterface",name = "MyService", targetNamespace="http://ws.test")

      public class MyService implements MyServiceInterface{

            @WebMethod

             public @WebResult StandardResponse foo() throws TestFaultMessage{

             return new StandardResponse();

            }

      }

      {code}

            

      Interface

       

       

      {code}

      @WebService(name = "MyService", targetNamespace="http://ws.test")

      public interface MyServiceInterface {

       

            @WebMethod

             public @WebResult StandardResponse foo() throws TestFaultMessage;

      }

      {code}

       

       

      When the WSDL is generated via Servlet i.e., using ?wsdl

       

      I am getting the following

       

       

           {code}

      <definitions name='MyServiceService' targetNamespace='http://ws.test' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://ws.test/' xmlns:ns2='http://b.ws.test/' xmlns:ns3='http://a.ws.test/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://ws.test' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

      <types>

        <xs:schema targetNamespace='http://b.ws.test/' version='1.0' xmlns:ns1='http://a.ws.test/' xmlns:ns2='http://ws.test' xmlns:xs='http://www.w3.org/2001/XMLSchema'>

         <xs:import namespace='http://a.ws.test/'/>

         <xs:import namespace='http://ws.test'/>

         <xs:element name='TestFaultMessage' type='ns2:TestFaultMessage'/>

         <xs:complexType name='fooResponse'>

          <xs:complexContent>

           <xs:extension base='ns1:fooResponse'>

            <xs:sequence/>

           </xs:extension>

          </xs:complexContent>

         </xs:complexType>

        </xs:schema>

        <xs:schema targetNamespace='http://a.ws.test/' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>

         <xs:complexType name='fooResponse'>

          <xs:sequence>

           <xs:element name='hello' type='xs:string'/>

          </xs:sequence>

         </xs:complexType>

        </xs:schema>

        <xs:schema targetNamespace='http://ws.test' version='1.0' xmlns:ns1='http://ws.test/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>

         <xs:import namespace='http://ws.test/'/>

         <xs:element name='foo' nillable='true' type='ns1:foo'/>

         <xs:element name='fooResponse' nillable='true' type='ns1:fooResponse'/>

         <xs:complexType name='TestFaultMessage'>

          <xs:sequence>

           <xs:element minOccurs='0' name='message' type='xs:string'/>

          </xs:sequence>

         </xs:complexType>

        </xs:schema>

        <xs:schema targetNamespace='http://ws.test/' version='1.0' xmlns:ns1='http://b.ws.test/' xmlns:tns='http://ws.test/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>

         <xs:import namespace='http://b.ws.test/'/>

         <xs:element name='foo' type='tns:foo'/>

         <xs:element name='fooResponse' type='tns:fooResponse'/>

         <xs:complexType name='foo'>

          <xs:sequence/>

         </xs:complexType>

         <xs:complexType name='fooResponse'>

          <xs:sequence>

           <xs:element minOccurs='0' name='return' type='ns1:fooResponse'/>

          </xs:sequence>

         </xs:complexType>

        </xs:schema>

      </types>

      <message name='MyService_fooResponse'>

        <part element='tns:fooResponse' name='fooResponse'></part>

      </message>

      <message name='TestFaultMessage'>

        <part element='tns:TestFaultMessage' name='TestFaultMessage'></part>

      </message>

      <message name='MyService_foo'>

        <part element='tns:foo' name='foo'></part>

      </message>

      <portType name='MyService'>

        <operation name='foo' parameterOrder='foo'>

         <input message='tns:MyService_foo'></input>

         <output message='tns:MyService_fooResponse'></output>

         <fault message='tns:TestFaultMessage' name='TestFaultMessage'></fault>

        </operation>

      </portType>

      <binding name='MyServiceBinding' type='tns:MyService'>

        <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>

         <fault name='TestFaultMessage'>

          <soap:fault name='TestFaultMessage' use='literal'/>

         </fault>

        </operation>

      </binding>

      <service name='MyServiceService'>

        <port binding='tns:MyServiceBinding' name='MyServicePort'>

         <soap:address location='http://cvdxe96533-lh03:8080/TSMVRClient/MyService'/>

        </port>

      </service>

      </definitions>

           {code}

      This is invalid because,

       

      {code:xml}

      <part element='tns:TestFaultMessage' name='TestFaultMessage'></part>

      {code}

       

       

       

      should have been,

       

       

      {code:xml}

      <part element='ns2:TestFaultMessage' name='TestFaultMessage'></part>

      {code}