5 Replies Latest reply on Jul 18, 2006 8:06 AM by amitdutta

    Cannot find child element: not using namespace ?

    dust_puppy

      Hi
      i get javax.xml.rpc.JAXRPCException: Cannot find child element: getVersionReturn when i am calling an external webservice from AS 4.0.4.GA.

      i have the folowing WSDL

      <wsdl:message name="getVersionResponse">
       <wsdl:part name="getVersionReturn" type="xsd:string"/>
       </wsdl:message>
      
      <wsdl:operation name="getVersion">
       <wsdl:input message="impl:getVersionRequest" name="getVersionRequest"/>
       <wsdl:output message="impl:getVersionResponse" name="getVersionResponse"/>
       </wsdl:operation>
      
      <wsdl:operation name="getVersion">
       <wsdlsoap:operation soapAction=""/>
       <wsdl:input name="getVersionRequest">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://netcom.no/xil/2003/09/location" use="encoded"/>
       </wsdl:input>
       <wsdl:output name="getVersionResponse">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://netcom.no/xil/2003/09/location" use="encoded"/>
       </wsdl:output>
       </wsdl:operation>
      

      and i have used wstool to generate the jaxrpc maping
      <service-endpoint-method-mapping>
       <java-method-name>getVersion</java-method-name>
       <wsdl-operation>getVersion</wsdl-operation>
       <wsdl-return-value-mapping>
       <method-return-value>java.lang.String</method-return-value>
       <wsdl-message xmlns:wsdlMsgNS='http://netcom.no/xil/2003/09/location'>wsdlMsgNS:Location_getVersionResponse</wsdl-message>
       <wsdl-message-part-name>result</wsdl-message-part-name>
       </wsdl-return-value-mapping>
       </service-endpoint-method-mapping>


      i turnd on debuging and got the following output
      17:09:58,232 DEBUG [SOAPConnectionImpl] Outgoing SOAPMessage
      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <env:Header/>
       <env:Body>
       <ns1:getVersion xmlns:ns1='http://netcom.no/xil/2003/09/location'/>
       </env:Body>
      </env:Envelope>
      17:09:58,232 DEBUG [HTTPClientInvoker] Setting request header with SOAPAction : ""
      17:09:58,232 DEBUG [HTTPClientInvoker] Setting request header with Content-Type : text/xml; charset=UTF-8
      ...
      
      ...
      17:09:58,263 DEBUG [MessageFactoryImpl] createMessage: [contentType=text/xml; charset=utf-8]
      17:09:58,263 DEBUG [SOAPContentElement] setXMLFragment: <ns1:getVersionReturn xsi:type='xsd:string'>Location Web Service version 1 build 007</ns1:getVersionReturn>
      17:09:58,263 DEBUG [SOAPConnectionImpl] Incomming Response SOAPMessage
      <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
       <soapenv:Header/>
       <soapenv:Body>
       <ns1:getVersionResponse soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:ns1='http://netcom.no/xil/2003/09/location'>
       <ns1:getVersionReturn xsi:type='xsd:string'>Location Web Service version 1 build 007</ns1:getVersionReturn>
       </ns1:getVersionResponse>
       </soapenv:Body>
      </soapenv:Envelope>
      17:09:58,263 DEBUG [SOAPBindingProvider] unbindResponseMessage: {http://netcom.no/xil/2003/09/location}getVersion
      17:11:14,327 DEBUG [MessageContextAssociation] popMessageContext: org.jboss.ws.soap.SOAPMessageContextImpl@c1bdd7
      17:11:14,327 ERROR [STDERR] java.rmi.RemoteException: Call invocation failed: Cannot find child element: getVersionReturn; nested exception is:
       javax.xml.rpc.JAXRPCException: Cannot find child element: getVersionReturn


      i downloaded the jbossWS source and debuged the code in the method org.jboss.ws.binding.soap.SOAPBindingProvider.getParameterFromMessage()
      it compairs xmlName and elName chich in my case are
      xmlName= getVersionReturn
      elName= {http://netcom.no/xil/2003/09/location}getVersionReturn

      i have tryed to modefly booth wsdl and jaxrpc but nu sucsess =(, should it not use the namespace on the "part" that i specefy in the operation ?

      i hope someone can help me with this becaus i am out of ideas =/

      many thanks
      /ANders

        • 1. Re: Cannot find child element: not using namespace ?
          dust_puppy

          i think my problem is that my message has the namespace on getVersionResponse

          <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
           <soapenv:Header/>
           <soapenv:Body>
           <ns1:getVersionResponse soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:ns1='java:com.netcom.positioning'>
           <ns1:getVersionReturn xsi:type='xsd:string'>Location Web Service version 1 build 007</ns1:getVersionReturn>
           </ns1:getVersionResponse>
           </soapenv:Body>
          </soapenv:Envelope>


          in other webservices i have tried the "part" dont have a the namespace on it, is there a way to define this in the WSDL or is this message not following the standard ?

          /Dust

          • 2. Re: Cannot find child element: not using namespace ?
            dust_puppy

            This might be a really stupid question but I can?t get this to work =/ any input is appreciated

            Should not the namespace specified in the soap operation be used when parsing the incoming xml ? i use a JSR-109 client as described in the documentation..

            Now I cant se any different in behavior when i change the namespace of a operations body.. Not even in the outgoing message is this not a bug ?

            like

            <wsdl:operation name="getVersion">
             <wsdlsoap:operation soapAction=""/>
             <wsdl:input name="getVersionRequest">
             <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://netcom.no/xil/2003/09/location" use="encoded"/>
             </wsdl:input>
             <wsdl:output name="getVersionResponse">
             <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://netcom.no/xil/2003/09/location" use="encoded"/>
             </wsdl:output>
             </wsdl:operation>



            the outgoing namespace is always the same
            <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.
            org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
             <soapenv:Header/>
             <soapenv:Body>
             <ns1:getVersionResponse soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:ns1='
            http://netcom.no/xil/2003/09/location'>
             <ns1:getVersionReturn xsi:type='xsd:string'>Location Web Service version 1 build 007</ns1:getVersionReturn>
             </ns1:getVersionResponse>
             </soapenv:Body>
            </soapenv:Envelope>


            • 3. Re: Cannot find child element: not using namespace ?
              dust_puppy

              solved the problem.. to get it to use namespace for its element i needed to extract the part to its own element like

              <wsdl:message name="getVersionResponse">
               <wsdl:part name="getVersionReturn" element="impl:getVersionReturn" />
               </wsdl:message>
              
              <xsd:element name="getVersionReturn" type="xsd:string" />
              


              if thos can help anyone else =)

              /Anders

              • 4. Re: Cannot find child element: not using namespace ?
                ankita_29yahoo

                Hello,
                I am facing the same problem.I am calling axis webservice with jbossWS client.Webservice is being called by while returning the result,it throws exception as no child element found for return type.I suppose it is about soap messages.Can you please post your solution how you modified wsdl which can be helpful for me too.
                Thanks,
                Ankita

                • 5. Re: Cannot find child element: not using namespace ?
                  amitdutta

                  Hello Anders,

                  We too are facing the same problem... Could you please let us know what exactly you did to solve the problem step by step.
                  We have axis webservices deployed and using jbossws for client.
                  Could you elaborate the solution?

                  Regards,
                  AD