1 Reply Latest reply on Oct 6, 2011 7:04 AM by PierreSolutions

    Flex - Parsing a SOAP Response

    david77007

      Greetings!

       

      I have a SOAP response from a webservice that i am trying to parse to a datagrid.  The information that comes back to the result handler is in the format of:

       

      SOAPENV:ENVELOPE

      -- soapenv:body

      ----ns2:serviceResponse

      ------ns2:return

      --------ns1:data

       

       

      I'm trying to figure out how to grab everything in ns1 and populate that information to a grid.  I'm very new to flex - anyone out there who can help?

       

      Thanks so much!

        • 1. Re: Flex - Parsing a SOAP Response
          PierreSolutions

          You'll have to use NAMESPACES.

          The code below is for illustration, you'll have to figure out the exact syntax that works, but to access data within XML that has namespaces (ns2, ns1) you could do something like ...

           

          var ns1:Namespace;

          var ns2:Namespace;

          var myData:XMLListCollection;

           

          myXML = XML(event.result.Data); // the data returned from the service

          ns2 = myXML.namespace("ns2"); // declare the namespaces

          ns1 = myXML.namespace("ns1");

          myData = new XMLListCollection( myXML.ns2::serviceResponse.return.ns1::data ); // use those namespaces to access the pieces of data you are interested in.

           

          Look for namespace at the link below

          http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=4