4 Replies Latest reply on Sep 4, 2007 3:22 AM by jmaasing

    Cannot find child element - with namespace

    jmaasing

      We have a problem with an XFire generated client. The SOAP request generated from the XFire client When we try to access the JBoss 4.0.5GA-WS service we send the following SOAP request:


      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soap:Body>
       <ns1:getInvoiceData xmlns:ns1="http://ws.test.se/jaws">
       <ns1:InvoiceRequest xmlns:ns2="http://jaws.ws.test.se/jaws">
       <ns1:fromInvDate>2006-02-28T14:41:13.860+01:00</ns1:fromInvDate>
       </ns1:InvoiceRequest>
       </ns1:getInvoiceData>
       </soap:Body>
      </soap:Envelope>
      


      This request generates an error:

      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
      <env:Header/>
       <env:Body>
       <env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <faultcode>env:Client</faultcode>
       <faultstring>Cannot find child element: InvoiceRequest</faultstring>
       </env:Fault>
       </env:Body>
      </env:Envelope>


      If we open the WSDL in SoapUI it generates a request that looks like this:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jaws="http://ws.test.com/jaws">
       <soapenv:Header/>
       <soapenv:Body>
       <jaws:getInvoiceData>
       <InvoiceRequest>
       <jaws:fromInvDate>?</jaws:fromInvDate>
       </InvoiceRequest>
       </jaws:getInvoiceData>
       </soapenv:Body>
      </soapenv:Envelope>


      Notice the missing jaws namespace on InvoiceRequest (exactly what the errormessage said :)).

      The question is if XFire is producing invalid SOAP Request based on the WSDL? Is there a problem on the JBoss-WS side? Or is there something amiss in the document encoding perhaps?

      WSDL.
      <definitions name='InvoiceService'
      targetNamespace='http://ws.test.com/jaws'
      xmlns='http://schemas.xmlsoap.org/wsdl/'
      xmlns:ns1='http://jaws.ws.test.com/jaws'
      xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
      xmlns:tns='http://ws.test.com/jaws'
      xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
       <types>
       <schema elementFormDefault='qualified' targetNamespace='http://jaws.ws.test.com/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns1='http://ws.test.com/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://jaws.ws.test.com/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
       <import namespace='http://ws.test.com/jaws'/>
       <simpleType name='String1'>
       <restriction base='string'>
       <minLength value='0'/>
       <maxLength value='1'/>
       </restriction>
       </simpleType>
      
       </schema>
       <schema elementFormDefault='qualified' targetNamespace='http://ws.test.com/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns2='http://jaws.ws.test.com/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://ws.test.com/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
       <import namespace='http://jaws.ws.test.com/jaws'/>
      
       <complexType name='InvoiceData'>
       <sequence>
       <element name='address' type='ns2:String1'/>
       </sequence>
       </complexType>
       <!-- Input for request of an getInvoiceData -->
       <complexType name='InvoiceRequest'>
       <sequence>
       <element name='fromInvDate' nillable='true' type='ns2:String1'/>
       </sequence>
       </complexType>
       </schema>
       </types>
       <message name='Invoice_getInvoiceData'>
       <part name='InvoiceRequest' type='tns:InvoiceRequest'/> </message> <message name='Invoice_getInvoiceDataResponse'>
       <part name='result' type='tns:InvoiceData'/> </message>
      
       <portType name='Invoice'>
       <operation name='getInvoiceData' parameterOrder='InvoiceRequest'>
       <input message='tns:Invoice_getInvoiceData'/>
       <output message='tns:Invoice_getInvoiceDataResponse'/>
       <fault message='tns:WebServiceFault' name='WebService'/>
       </operation>
       </portType>
       <binding name='InvoiceBinding' type='tns:Invoice'>
       <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
      
       <operation name='getInvoiceData'>
       <soap:operation soapAction=''/>
       <input>
       <soap:body namespace='http://ws.test.com/jaws' use='literal'/>
       </input>
       <output>
       <soap:body namespace='http://ws.test.com/jaws' use='literal'/>
       </output>
       </operation>
       </binding>
      
       <service name='InvoiceService'>
       <port binding='tns:InvoiceBinding' name='InvoicePort'>
       </port>
       </service>
      
      </definitions>