A reminder that pre 3.5sdk there is a bug where the responder can get called 
twice.

Bug SDK-22883 Incorrectly Functioning HTTPService responders are called twice


Steps to reproduce:
1. Run HTTPServiceTest.mxml from the attached zip file. It calls one service 
that should succeed and one service that should fail.
 
Actual Results:
The result and the fault method of the AsyncToken responder are called twice.
 
Expected Results:
Each method should be called only once.
 
Workaround (if any):
Add a result and a fault listener to the HTTPService directly. Then the result 
and the fault method of the AsyncToken responder are called only once as 
expected. 


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
creationComplete="onCreationComplete()">
        <mx:Script>
        <![CDATA[
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                import mx.rpc.AsyncToken;
                
                private function onCreationComplete():void {
                        // should succeed
                        var token1:AsyncToken = service1.send();
                        token1.addResponder (new mx.rpc.Responder (result, 
fault));
                        // should fail
                        var token2:AsyncToken = service2.send();
                        token2.addResponder (new mx.rpc.Responder (result, 
fault));
                }
                private function result(event:Event):void {
                        out (event.type, ResultEvent(event).messageId);
                }
                private function fault(event:Event):void {
                        out (event.type, FaultEvent(event).messageId);
                } 
                private function out(...args):void {
                        var newLine:String = args.join (" - ");
                        trace (newLine);
                        monitor.text = monitor.text + newLine + "\n";
                } 
                private function nothing ():void {}
        ]]>
        </mx:Script>
        <mx:HTTPService id="service1" url="http://www.adobe.com"; 
resultFormat="text"
                result="nothing()" fault="nothing()"/>
        <mx:HTTPService id="service2" url="http://xxx.adobe.com"; 
resultFormat="text"
                result="nothing()" fault="nothing()"/>
        <mx:Text id="monitor" width="100%" height="100%"/>
</mx:Application>






--- In [email protected], "Tracy Spratt" <tr...@...> wrote:
>
> The bracket notation replaces the dot notation:
> 
> var token:AsyncToken = service[str] (); //remove the dot
> 
> 
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _____  
> 
> From: [email protected] [mailto:[email protected]] On
> Behalf Of claudiu ursica
> Sent: Tuesday, December 15, 2009 6:31 AM
> To: [email protected]
> Subject: [SPAM] Re: [flexcoders] var token:AsyncToken = service.[str](); how
> to get this working?
> 
>  
> 
>   
> 
> It is service.send() at least if your service is a HTTPService instance.
> C
> 
>  
> 
>   _____  
> 
> From: MicC <chigwel...@...>
> To: [email protected]
> Sent: Tue, December 15, 2009 1:08:22 PM
> Subject: [flexcoders] var token:AsyncToken = service.[str](); how to get
> this working?
> 
>   
> 
> When used conventionally - var token:AsyncToken = 
> service.Sel_ all_mgrs( ); - this is service.function, right?
> 
> var str:String = 'Sel_all_mgrs' ;
> var token:AsyncToken = service.[str] ();
> token.addResponder( this.responder) ;
> 
> What is the correct code to get the above working? TIA,
> 
> Mic.
>


Reply via email to