Skip to main content
Inspiring
January 15, 2014
Answered

Are web method calls synchronous (not counting result/fault handlers)?

  • January 15, 2014
  • 2 replies
  • 1305 views

Take the following code:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="ws.loadWSDL('someWSDL');">

    <mx:Script>

        <![CDATA[

            private function onLoad():void

            {

                ws.WebMethodCall("msg");

                navigateToURL(new URLRequest("someURL"), "_self");

            }

        ]]>

    </mx:Script>

    <mx:WebService id="ws" load="onLoad()">

        <mx:operation name="WebMethodCall"/>

    </mx:WebService>

</mx:Application>

Will ws.WebMethodCall("msg"); definitely fully transmit the method call to the server before the next line is entered into?  I know that the server may take time to process the call and try to resond, but that's not what I'm talking about.  Will the call definitely be transmitted to the server, as in a ball being thrown from one person to another in a game of catch, before the next line of code is entered into and executed?  Is there any chance whatsoever that navigateToURL may provoke a fault?  Thank you.

This topic has been closed for replies.
Correct answer kglad

I just wanted to make sure you were saying that, even without networking issues, the server won't necessarily receive the call before the page redirects and kills the client script.  I mean, I'm pretty sure that's what you're saying, but I just wanted to confirm.


you cannot rely on the server receiving anything from flash before (or after) navigateToURL causes your browser to redirect. 

and sinious is correct: if you want to ensure that the server receives the call before your redirect use a listener for confirmation that the server received the call before executing navigateToURL.

2 replies

sinious
Legend
January 15, 2014

It is asynchronous for a multitude of reasons. To be sure, just do what you know. Assign a result handler and only when the server responds will you know it received the request so you can fire off your navigateToURL().

kglad
Community Expert
Community Expert
January 15, 2014

that line of code will execute but the server will not receive the call before the navigateToURL executes.

Inspiring
January 15, 2014

So this could provoke a fault?

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 15, 2014

I just wanted to make sure you were saying that, even without networking issues, the server won't necessarily receive the call before the page redirects and kills the client script.  I mean, I'm pretty sure that's what you're saying, but I just wanted to confirm.


you cannot rely on the server receiving anything from flash before (or after) navigateToURL causes your browser to redirect. 

and sinious is correct: if you want to ensure that the server receives the call before your redirect use a listener for confirmation that the server received the call before executing navigateToURL.