Once I run my Flex application, it successfully gets the SOAP response and populate the values in dropdown box but they are empty, in other words, when I hover the mouse on my dropdown box I can see that it has three empty values.
my flex code
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function
dropDownList_creationCompleteHandler(event:FlexEvent):void
{
myResults.token = myservice.myUsers();
}
]]>
</fx:Script>
<fx:Declarations>
<myservice:myservice id="myservice"/>
<s:CallResponder id="myResults"/>
</fx:Declarations>
<s:FormItem label="Label">
<s:DropDownList id="dropDownList"
creationComplete="dropDownList_creationCompleteHandler(event)"
labelField="name">
<s:AsyncListView list="{myResults.lastResult}"/>
</s:DropDownList>
</s:FormItem>
XML is
<?xml version="1.0" encoding="UTF-8"?>
<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>
<myusersResponse xmlns="http://Services.com">
<myusersReturn>
<name>Nicole</name>
<age>50</age>
</myusersReturn>
<myusersReturn>
<name>Jayne</name>
<age>40</age>
</myusersReturn>
<myusersReturn>
<name>Alex</name>
<age>33</age>
</myusersReturn>
</myusersResponse>
</soapenv:Body>
</soapenv:Envelope>
David Goshadze
Check xmlns namspace.
the following code i wrote to emulate your problem works fine:
<?xml version="1.0" encoding="utf-8"?>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.events.FlexEvent;
import mx.messaging.messages.SOAPMessage;
[Bindable]
var _result:*;
protected function
dropDownList_creationCompleteHandler(event:FlexEvent):void
{
var xml:XML = <Body>
<myusersResponse>
<myusersReturn>
<name>Nicole</name>
<age>50</age>
</myusersReturn>
<myusersReturn>
<name>Jayne</name>
<age>40</age>
</myusersReturn>
<myusersReturn>
<name>Alex</name>
<age>33</age>
</myusersReturn>
</myusersResponse>
</Body>;
_result = new XMLListCollection(new XMLList(xml.myusersResponse.myusersReturn));
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<s:FormItem label="Label">
<s:DropDownList id="dropDownList"
creationComplete="dropDownList_creationCompleteHandler(event)"
labelField="name">
<s:AsyncListView list="{_result}"/>
</s:DropDownList>
</s:FormItem>
But if you add xmlns="http://Services.com to myusersResponse tag it fails.
EDIT: In case you need namespace workaround, I just answered Jack Moores question with namespace solution here My flex code does not parse the soap response properly
来源:https://stackoverflow.com/questions/14314467/dropdown-list-does-not-show-its-values