I'm a .NET guy, have been for about 9 years now. I've got a web service that returns a string of XML. I'm calling that webservice and getting myresponse through FLEX (of which I'm very new). The problem is that I can't get the XML back out like I'm expecting. I'm hopingmy code sample will help you help me out here. I've copied and pasted various pieces but it's not quite there. I get zilch on the as XML line:
My webservice area:
<mx:WebService id="photos" wsdl="http://localhost:3833/WebServices/GalleryService.asmx?WSDL" fault="faultHandler(event)" >
<mx:operation name="getPhotos" result="xmlQuery(event)" resultFormat="e4x" fault="mx.controls.Alert.show(event.fault.faultString)" >
My result area:
private function xmlQuery(event:ResultEvent):void
//myXML = event.result as XML;
myXML = new XML(event.result);
mainImage.source = myXML.pic.image;
event.result has the following:
myXML is always NULL!
Thanks in advance for any help you can offer!
Can you post your full ResultEvent.result ?
Is it something similar to:
<invokeResponse xmlns="http://adobe.com/idp/services" 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">
<xmlCashSummary xsi:type="ns1:XML" xmlns:ns1="http://adobe.com/idp/services">
<document><![CDATA[<?xml version="1.0"?><root><Record><TOTAL type="NUMBER">10500000</TOTAL><USED type="NUMBER">1018001.4</USED><BALANCE type="NUMBER">9481998.6</BALANCE></Record></root>]]></document>
If it is, then you need to write an XML parser to clear all the xmlns:xsi, xsi:type etc... and take out the content in the <document> tag.
Try using your webserviceID.lastResult.YourXMLRootNOde
or in result handler take result as XMLList and not XML.
Check these links.
Mark Accordingly if this post helps.