Bruce,
 
The loadWSDL() method fires asycnhronously. You will need to load the wsdl up front then call the service.  Try that and see if you get a little further.
 
 
Carson

____________________________________________
 
Carson Hager
Cynergy Systems, Inc.
http://www.cynergysystems.com
 
Email:  [EMAIL PROTECTED]
Office:  866-CYNERGY
Mobile: 1.703.489.6466

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of phillips1021
Sent: Saturday, October 21, 2006 10:34 AM
To: [email protected]
Subject: [flexcoders] Using ActionScript 3.0 WebService Class - Need Help

I'm trying to learn how to use the WebService class in ActionScript
3.0 as part of a Flex 2.0 XML tutorial I'm writing for my blog
(www.brucephillips.name/blog).

I'm having great difficulty getting the code below to work. I've read
throught the RPC components section of the Flex 2 Developer's Guide
and the WebServices description in the ActionScript 3.0 Reference.
I've also search through FlexCoders and Google. The references are
extremely POOR in giving working examples of how to use class WebService.

The below code uses the currency exchange rate WebService described
here: http://www.xmethods.net (under demo services). I know the
WebService works as I've tested it using ColdFusion.

Any help you can provide me would be much appreciated and I will
mention your assistance in my blog. The problem appears that my
resultHandler function is never called as the test in my TextArea
component does not change.

Here is the code:

<?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 mx.rpc.soap.LoadEvent;


import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;


import mx.rpc.soap.WebService;

public function useWebService():void {

var service:WebService = new WebService();
service.wsdl =
"http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl"
service.getRate.addEventListener("result", resultHandler);
service.getRate.addEventListener("fault", faultHandler);
service.loadWSDL();
service.getRate("canada", "united states");

}



public function resultHandler(event:ResultEvent):void
{

myTextArea.text = "Result returned";

}

public function faultHandler(event:FaultEvent):void {

Alert.show("fault: "+ event.toString());

}


]]>
</mx:Script>
<mx:TextArea x="134" y="65" id="myTextArea" text="getting service"/>
</mx:Application>

Thanks in advance.

Bruce Phillips

__._,_.___

--
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
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to