0 Replies Latest reply on Jan 20, 2014 8:37 AM by olegkon

    Extracting XML from webservice result with Namespaces using E4X

    olegkon Level 1

      Hi,

       

      I need to extract some data from proprietary Web Service (to be fed to HierarchicalData for dataProvider of ADG).

       

      So I made service.returnType=’e4x’;

      In that case it returns data as XML.

       

      I need to get useful data from it after Snapshot:

      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

      <SOAP-ENV:Header xmlns:msdwHdr="http://xml.msdw.com/ns/appmw/soap/1.0/header">

      <msdw:RequestID xmlns:msdw="http://xml.msdw.com/ns/appmw/soap/1.0/header">restsoap#1390182244050#197728273958044232</msdw:RequestID>

      <msdwHdr:FinalMessage>true</msdwHdr:FinalMessage>

      </SOAP-ENV:Header>

      <SOAP-ENV:Body>

      <ADSSnapshotResponse xmlns="http://xml.ms.com/ns/appmw/dataserver/1.0">

      <Snapshot seqNo="0">

      <BASE_ELEMENT_NAME BASE_ELEMENT_NAME="4.11.2.0">

      ……..

       

      Using E4X, like:

      var root:XML = event.result as XML; //good!


      var xmlRoot1:XMLList = root['SOAP-ENV:Body'].ADSSnapshotResponse.Snapshot.BASE_ELEMENT_NAME;

      it does return XMLList (tried different variants), but debugger shows nothing at all inside that XMLList.


      var root1:XMLList = root.children();  // that returns valid XMLList with 2 XML elements inside

       

      But all other data I could not get if I use any E4X:

       

      Can I skip Envelope, going to Body as one of its children?  suppose I can...

       

      a) root.SOAP-ENV:Body would give compilation errors because of ‘-‘, ‘:’

       

      b) root.Body gives blank XMLList

       

      c) root.Body[0] returns NULL  

       

       

      Any idea how to extract the load from ADS Response (envelope)?

       

      What can I do regarding XML Namespaces in E4X ?

       

       

      If I set service.returnType="xml" it returns data as XMLNode's.

      But I prefer to use E4X if possible.

       

      Please help!

       

      TIA,

      Oleg.

       

      P.S.: using Flex 4.5.1 with Flex3 ADG.