event.result is an Object.  That is why you see that [object Object] displayed when you try to display it in a text field. And you should use lastResult. “result” might work sometimes, but it is not best practice.

 

Try:

trace("result " + event.lastResult.toString());

or

trace("result " + event.lastResult.toXMLString());

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of wayne_badu_johnson
Sent: Tuesday, June 06, 2006 8:31 PM
To: [email protected]
Subject: [flexcoders] loadWSDL Webservice result?

 

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]

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to