Jack Moore
Jack Moore

Reputation: 131

Flex application cant parse xml returned by web services

My Flex application properly call a web service but it does not populate the drop down box.

Once I run the application the drop down box is empty.

my flex code is as following

<fx:Script>

    <![CDATA[
        import mx.controls.Alert;
        import mx.events.FlexEvent;

        protected function  
                    dropDownList2_creationCompleteHandler(event:FlexEvent):void
        {
            mycustomersResult2.token = hellos.mycustomers();
        }

    ]]> 
</fx:Script>

    <fx:Declarations>

    <hellos:Hellos id="hellos" fault="Alert.show(event.fault.faultString + '\n' 
             + event.fault.faultDetail)"
             showBusyCursor="true"/>

    <s:CallResponder id="mycustomersResult2"/>

</fx:Declarations>

 <s:FormItem label="Label">
  <s:DropDownList id="dropDownList2"
       creationComplete="dropDownList2_creationCompleteHandler(event)"
       labelField="age">
       <s:AsyncListView list="{mycustomersResult2.lastResult}"/>
  </s:DropDownList>
  </s:FormItem>

Upvotes: 2

Views: 313

Answers (2)

Alexander Farber
Alexander Farber

Reputation: 22958

You don't need to use a server/network monitor while debugging this.

Just create a temporary const holding your XML code and work with it:

/*private static*/ const MY_XML:XML =
<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
    <mycustomersResponse xmlns="http://Services.com">
      <mycustomersReturn>
          <age>28</age>
          <name>Jack</name>
      </mycustomersReturn>
      <mycustomersReturn>
          <age>29</age>
          <name>Ben</name>
      </mycustomersReturn>
   </mycustomersResponse>
 </soapenv:Body>
</soapenv:Envelope>;

(yes, do not use any quotes above).

Upvotes: 3

powercoder23
powercoder23

Reputation: 1404

can you please check this line in the debug mode using watch expression?

mycustomersResult2.lastResult.mycustomersResponse

make sure your lastResult should have mycustomersResponse property.

Thanks, Dhiraj

Upvotes: 2

Related Questions