0 Replies Latest reply on May 1, 2007 5:22 PM by lemdan44

    Problem accessing array within soap response

    lemdan44
      I am trying to find a way to retrieve within Flex 2 an array data type that is provided by my Web Services within a SOAP envelope.

      Here is my small application that makes the request to my Web Services.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      creationComplete="A_WebService.Renvoi_Prix_Doc.send()" >
      <mx:Script>
      <![CDATA[
      import mx.rpc.events.*;
      import mx.collections.*;
      import mx.controls.*;
      [Bindable]
      private var My4dData:XMLList;

      private function bookHandler(evt:ResultEvent):void
      {
      trace (evt.result);
      My4dData = evt.result.Erreur;
      }
      ]]>
      </mx:Script>
      <mx:WebService id="A_WebService" wsdl=" http://localhost:8080/4dwsdl" useProxy="false">
      <mx:operation name="Renvoi_Prix_Doc" result="bookHandler(event)" resultFormat="e4x">
      <mx:request>
      <Designation>Test</Designation>
      </mx:request>
      </mx:operation>
      </mx:WebService>
      </mx:Application>


      Here is my soap response in E4X to my Web Services.

      [SWF] Users:daniellemaire:Documents:Flex Builder 2:E4X:bin:E4X2-debug.swf - 1Ê005Ê877 bytes after decompression
      <ns1:Renvoi_Prix_DocResponse SOAP-ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:ns1=" http://www.4d.com/namespace/default" xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
      <Prix xsi:type="xsd:float">4.580000000000000071</Prix>
      <Erreur xsi:type="xsd:int">4</Erreur>
      <TabLong href="#ref-1"/>
      <TabText href="#ref-2"/>
      </ns1:Renvoi_Prix_DocResponse>
      <SOAP-ENC:Array id="ref-1" SOAP-ENC:arrayType="xsd:int[4]" xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
      <item1>1</item1>
      <item2>2</item2>
      <item3>3</item3>
      <item4>4</item4>
      </SOAP-ENC:Array>
      <SOAP-ENC:Array id="ref-2" SOAP-ENC:arrayType="xsd:string[4]" xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
      <item1>Un</item1>
      <item2>Deux</item2>
      <item3>Trois</item3>
      <item4>Quatre</item4>
      </SOAP-ENC:Array>

      I am able to gather the two first values: Prix and Erreur but I do not know how to get my two arrays.

      This problems is bugging me. I searche everywhere in the internet and I found nothing related to the management of complex data type.

      Thank you very much in advance if you could help me.