Hi
I'm using Flex 2 Beta 3, I am calling a webservice thru actionscript
and recieving results, however I am having trouble accessing the
data from the result.
Tracing event.result I get:
result [object Object]
Tracing the event itself I get:
result [ResultEvent messageId="EEA0E785-23F9-C262-E303-ABE1D40AD22D"
type="result" bubbles=false cancelable=true eventPhase=2]
I have tried numerous ways (lastResult , event.result[0].name etc).
with no luck. It would appear that an actionscript webservice call
does allow me to specify a resultFormat, I would like to use e4x but
this property throws an error.
The WSDL works fine through mxml webservice call. I spotted a few
posts saying this may have been an issue with Beta 2 but it was
fixed in Beta 3.
Any thoughts welcome. (Stripped down code below)
Cheers
Wayne
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="useWebService();">
<mx:Script>
<![CDATA[
//
import flash.events.EventDispatcher;
import mx.rpc.soap.WebService;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.AbstractOperation;
//
private var ws:WebService;
//
public function useWebService():void {
// wsdl
ws = new WebService();
ws.wsdl = 'http://localhost:8080/macs-
ws/services/RetrieveEquipment?WSDL';
ws.loadWSDL();
ws.useProxy = false;
// operation
var op:AbstractOperation;
op = ws['findEquipment'];
ws.addEventListener("result",doResults);
ws.addEventListener("fault",doFault);
// args
var args:Object = new Object;
args.name = "MDIB UMUX-N 1";
op.arguments = args;
op.send();
}
//
public function doResults(event:ResultEvent):void {
trace("result " + event.result);
}
//
public function doFault(event:FaultEvent):void {
trace("fault " + event.fault.faultstring);
}
]]>
</mx:Script>
</mx:Application>
// Result trace
result [object Object]