You need to take a look through the "Handling asynchronous calls to
services" chapter in the Flex 2 Developer's Guide (around p. 1439 of the
.pdf file).
On 9/28/07, Fred Barrett <[EMAIL PROTECTED]> wrote:
>
> I have some back-to-back web service calls that don't seem to work
> when I call them as:
>
> ws.GetMusicians();
> ws.GetInstruments();
> ws.GetProducts();
>
> but if I call them in a forced-sequential pattern, they all work fine.
> (The web server is a .NET service that returns ArrayCollections).
>
> My mxml file calls my GAWebService tier:
> var ws = new GAWebService();
>
> The GAWebService tier handles the transaction with the web service:
>
> public function GetInstruments( ):void {
> ws.addEventListener( ResultEvent.RESULT, instrumentsHandler );
> var callToken:AsyncToken = ws.GetInstruments();
> callToken.marker = "GetInstrumentsCall";
> }
>
> private function instrumentsHandler( event:ResultEvent ):void {
> ws.removeEventListener( ResultEvent.RESULT, instrumentsHandler );
> var callToken:AsynchToken = event.token;
> var resultCollection:ArrayCollection = (event.result AS
> ArrayCollection);
> switch( callToken.toString() ) {
> case "GetInstrumentsCall":
> GADataModel.getInstance().Instruments = resultCollection;
> break;
> etc.
> }
> }
>
> Again, if I force a sequence wherein the handler of one call makes the
> next webservice call in the series, I get all of the results back, but
> if I leave it to the "asynch-ness" of the webservice, I only get a
> couple of the calls completed.
>
> Does the Flex WebService queue up the calls or do I have to write some
> sort of call queue class in order to manage the asynchronous traffic?
>
>
>