I'm having trouble using values from an XML file as parameters for a web service request.
I'm using an HTTPService to load the config file:
<mx:HTTPService id="configService" url="config.xml" resultFormat="e4x" result="configLoaded(event)"/>
The XML file looks something like this:
<root>
<data>
<wsdl>https://WEBSERVICEURL.foo/ws.asmx?WSDL</wsdl>
<username>ws_username</username>
<password>ws_password</password>
<clientID>1</clientID>
<centerID>1</centerID>
</data>
</root>
In the configLoaded()
method, I set the result of the HTTPService to an XML variable called configXML
and set the web service URL to the value of the node wsdl
.
private function configLoaded(event:ResultEvent):void
{
configXML = event.result as XML;
ws.loadWSDL(configXML.data.wsdl);
}
Everything works fine until I call the request:
<mx:WebService id="ws" useProxy="false" showBusyCursor="false">
<mx:operation name="GetContactTypes" resultFormat="e4x" result="getContactTypes(event)" fault="getContactTypesFault(event)">
<mx:request>
<clientID>{configXML.data.clientID}</clientID>
<centerID>{configXML.data.centerID}</centerID>
<username>{configXML.data.username}</username>
<password>{configXML.data.password}</password>
</mx:request>
</mx:operation>
</mx:WebService>
Instead of passing the values of the XML nodes, it passes the XML tags and the values, so instead of using 1
for clientID, it passes <clientID>1</clientID>
.
Any idea how I bind just the node values?
Thanks!