I have experienced the problem before, and I have found that using
AsyncToken is more reliable than listening to event.

 

In other words, the code would read like

 

var token:AsyncToken = ws.loadWSDL();

token.addResponder( some_thing_that_implements_IResponder );

 

it is weird.

 

-          Tangent

 

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Peter Connolly
Sent: Thursday, October 18, 2007 9:07 PM
To: [email protected]
Subject: Re: [flexcoders] Weird WebService Problem

 

The full incantation for handling a webservice in ActionScript is
shown in the Developer's Guide example:

<?xml version="1.0"?>
<!-- fds\rpc\WebServiceInAS.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
<mx:Script>
<![CDATA[
import mx.rpc.soap.WebService;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
private var ws:WebService;

public function useWebService(intArg:int, strArg:String):void {
ws = new mx.rpc.soap.WebService();
ws.destination = "echoArgService";
ws.echoArgs.addEventListener("result", echoResultHandler);
ws.addEventListener("fault", faultHandler);
ws.loadWSDL();
ws.echoArgs(intArg, strArg);
}

public function echoResultHandler(event:ResultEvent):void {
var retStr:String = event.result.echoStr;
var retInt:int = event.result.echoInt;
//Do something.
}

public function faultHandler(event:FaultEvent):void {
//deal with event.fault.faultString, etc
}
]]>
</mx:Script>
</mx:Application>

Are you doing all these steps?

On 10/18/07, Ben <[EMAIL PROTECTED] <mailto:thegoosmans%40gmail.com> >
wrote:
>
>
>
>
>
>
> In my Flex Application MXML file I call a function called init() on
> the creationComplete event. creationComplete="init();" In the init()
> function a WebService's wsdl property is set to the URL for my CFC.
> After the property is set I call a function on my service
> (service.getBlah();) but the request is never sent. However, if I set
> the WebService wsdl on the WebService MXML tag before I compile my
> program, the request is sent.
>
> I'm not sure what could be the problem here. It seems that there
> might be some time after the wsdl is set in which requests cannot be sent.
>
> Does anyone know? Thanks in advance!
>
> 

 

Reply via email to