I think part of my problem with this web service might be related to
the XML name space (see page 1150 in the Flex 2.0 Developer's Guide).
 However, I cannot figure out what the name space should be for the
web service.

I was able to use a different web service for my tutorial on using web
services that return XML in Flex 2.0.  You can read the tutorial here:

http://www.brucephillips.name/blog/index.cfm/2006/10/22/Using-XML-in-Flex--Tutorial-Part-4--WebService

I certainly appreciate any feed back or suggestions on how to get the
WebService code below to work.

Bruce

--- In [email protected], "phillips1021" <[EMAIL PROTECTED]> wrote:
>
> Carson - thanks for the reply.  I had previously tried handling the
> "load" event and then calling the getRate method from within the load
> handler, but that did not work either.  Here is the code with the
> loadWSDL being handled separately.
> 
> Any other ideas?
> 
> <?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.LoadEvent;
>         
>         import mx.rpc.soap.WebService;
>           
>         public var service:WebService ;
>         
>          
>          public function useWebService():void {
>               
>             service = new WebService();
>             service.wsdl =
> "http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl";
>             service.getRate.addEventListener("result", resultHandler);
>             service.getRate.addEventListener("fault", faultHandler);
>             service.addEventListener("load", loadHandler);
>             service.loadWSDL();
>              
>                       }
>                       
>               public function loadHandler(event:LoadEvent):void {
>                       
>                       Alert.show("load event");
>                       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>
> 
> Bruce
> 
> 
> --- In [email protected], "Carson Hager" <carson.hager@>
> wrote:
> >
> > 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 <http://www.cynergysystems.com/> 
> >  
> > Email:  carson.hager@
> > 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 <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
> > <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
> > <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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to