2 Replies Latest reply on May 18, 2010 3:30 AM by BhaskerChari

    Problem in Flex to get XML result from web services

    jbgao2009

      Hi all

      I am struggling a proplem for a whole day, i hope somebody can help.

      I am trying to get the list file of files located on the server, so i use flex to access a ASP.NET ASMX web services, that returns all the file names in a folder.

      I can see that web servicese worked perfectly, however when i try to get the result from flex, i could not figure out how to get the real data i wantted

       

       

      public function LoadImage(e:ResultEvent):void{

      imageList.dataProvider = e.result;

       

      the e.result has some addtional tags, such as

       

      <GetImageFileListResponse xmlns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <GetImageFileListResult>
          <images>
            <image>01417_ccurve_1280x1024.jpg</image>
            <image>1915619295407381096.png</image>
            <image>21051802471898733113.png</image>

       

      where GetImageFileList is the operation name used in web service

       

      I am only interested in the data starting from <images> . I don't know why the addtioanl tag has been added.

      here is the code i have used in flex.

       

      <mx:WebService

       

       

      wsdl="http://localhost/Flex/GetImageFiles.asmx?WSDL" id="imageWs">

       

       

      <mx:operation name="GetImageFileList" result="LoadImage(event)"

      fault="mx.controls.Alert.show(event.fault.faultString)" resultFormat="

      e4x">

       

       

      </mx:operation>

       

      </mx:WebService>

       

       

       

       

      Thanks in advance!!!