Skip to main content
Participant
November 3, 2010
Question

Parsing webservice parameters

  • November 3, 2010
  • 1 reply
  • 485 views

I would like to retrieve the parameters I send to a webservice from the result handler.  The webservice is being called multiple times in succession, so I cannot refer to the WebService object because it will only have the parameters for the last call.

In the result handler I have this in the event.token.message.body:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <tns:MyWebServiceMethod xmlns:tns="http://myServer/myWebService">
      <tns:RowNumber>
        2
      </tns:RowNumber>

      <tns:OtherParameters>
         ...
       </tns:OtherParameters>

    </tns:MyWebServiceMethod>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I really just need to get the value for RowNumber.  Thanks in advance.

This topic has been closed for replies.

1 reply

flex_netAuthor
Participant
November 3, 2010

I figured it outfrom here under Using XML NameSpaces, see the comment by Harley Powers Parks.

The solution is:

        XML.ignoreWhitespace; 
    var eXml:XML = new XML(event.token.message.body); 
    var eXmlList:XMLList = eXml.children(); 
    var soapNS:Namespace = eXml.namespace("SOAP-ENV"); 
    var xmlnsNS:Namespace = new Namespace("http://myServer/myWebService") 
    var resulteXmlList:XMLList = eXml.soapNS::Body.xmlnsNS::MyWebServiceMethod;

    var iRowNumber:Number = eXml.soapNS::Body.xmlnsNS::MyWebServiceMethod.xmlnsNS::RowNumber;