This issue came to me from a customer who wanted to catch the timeout of a webservice and then repeatedly re-dispatch the same webservice passing the parameters/data from the original call, but with a larger timeout, until some max timeout or max number of tries was reached.

Here is the code for the app:

<mx:application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:script>
        <!–[CDATA[
            import mx.controls.Alert;
            import mx.rpc.soap.WebService;
            import mx.managers.CursorManager;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.soap.LoadEvent;
            import mx.rpc.soap.Operation;

            [Bindable]–>           public var wsdlLoaded:Boolean=false;

            public var WS:WebService;

            public var callCount:int=0;
            public var maxCallCount:int=3;

    public function initWebService():void {

                CursorManager.setBusyCursor();

                WS = new WebService();

                //location of the Web Service Description
                WS.wsdl = "http://739saintlouis.com/services/TimeOut.cfc?wsdl";
                WS.endpointURI = "http://739saintlouis.com/services/TimeOut.cfc"

                //GetInfoByCity is the WebService method we want to use
                //and we want the results returned in the e4x XML format

                WS.useProxy=false;
                WS.requestTimeout=2;

                //specify the function that will handle the results
                //returned by the operation
                WS.test.addEventListener("result", resultHandler);

                //specify the method that will handle any faults
                WS.test.addEventListener("fault", faultHandler);

                //specify the method that will handle the
                //the event of loading the WSDL
                //once the WSDL is loaded we will call
                //our method in the function loadHandler
                WS.addEventListener("load", loadHandler);

                //Load the WSDL for this WebService
                WS.loadWSDL();

            }//end function useWebService          

            private function resultHandler(e:ResultEvent):void{
                ta.text+=e.result.toString();
            }
            private function faultHandler(e:FaultEvent):void{
                ta.text+="\n" + e.fault.toString() + "\n\n";
                //If we receive a timeout fault, resend the request.
                if (e.fault.faultCode=="Client.Error.RequestTimeout" &amp;&amp; callCount < maxCallCount) {
                        var args:Array=(e.target as Operation).arguments as Array;
                        if (!args){
                            ta.text+="\n\n could not recycle args!! \n break!!";
                        }else{
                            callCount++;
                            //double timeout and call again
                            WS.requestTimeout =  WS.requestTimeout * 2;
                            ta.text+="call count = " + callCount + "\n";
                            ta.text+="WS.requestTimeout = " + WS.requestTimeout + "\n";
                            var op:Operation = e.target as Operation;
                            op.send(args);
                        }
                }

            }

            private function loadHandler(e:LoadEvent):void{
                CursorManager.removeBusyCursor();
                wsdlLoaded=true;
                ta.text="wsdl loaded" + "\n\n"
            }

            private function sendData():void{
                callCount++;
                ta.text+="call count = " + callCount + "\n";
                ta.text+="WS.requestTimeout = " + WS.requestTimeout + "\n";
                // if you don’t set the operation arguments array, but instead
                // set args in operation method call - like WS.test(5)
                (WS.test as Operation).arguments=[5];
                WS.test.send();
            }
        ]]>
    </mx:script>

        <mx:button label="getWSDL" click="initWebService()">
        <mx:button label="sendData" click="sendData()" enabled="{wsdlLoaded}">
        <mx:textarea id="ta" width="400" height="400">

</mx:textarea>
</mx:button></mx:button></mx:application>

The key to this is in the sendData() function where I comment:

// if you don’t set the operation arguments array, but instead
// set args in operation method call - like WS.test(5)

just sending the arguments in the invokation of the webservice does apparently not result in the webservice.arguments array being populated. At least not apperently so when you receive the fault object due to the webservice timeout. But if you actually set the operation’s arguments array before you invoke the webservice operation, that array of arguments is returned in the fault, making it easy to redispatch the operation with the same arguments.

The app is below and if you click the getWSDL button, the app gets the wsdl and when it has been received and parsed, the sendData button will be enabled. Clicking the sendData button invokes the webservice operation. The operation times out and is invoked again. Each subsequent invocation of the webservice operation has a larger timeout, so the webservice will eventually process and return successfully. (In my sample I have set things so that on the 3rd try the timout is finally set so that the operation successfully returns before the timeout setting expires the request.)

Browse the source of this example.
Download a zipfile containing the source to this sample.

This movie requires Flash Player 9

Here is the simple cfc that I am invoking as a webservice from my Flex app.

<cfcomponent name="TimeOut">
    <cffunction name="test" access="remote" returntype="any">
        <cfargument name="requestTimeout" type="numeric" required="true">
        <cfscript>
            thread = createObject("java", "java.lang.Thread");
            thread.sleep(javaCast("long", 1000*arguments.requestTimeout));
        </cfscript>
        <cfreturn>
    </cfreturn>
</cfargument>
</cffunction></cfcomponent>