6 Replies Latest reply on Nov 11, 2009 11:32 AM by nikos101

    How do I respond to results from <s:CallResponder

    nikos101 Level 2

      How do I respond to results in the FB 4 generated code like the following


      <s:CallResponder id="updateCONVERTER_AGENTSResult2" result="Alert.show('Successfuly updated');"/>


      I tried the

      result="Alert.show('Successfuly updated')

      but nothing happens?

        • 1. Re: How do I respond to results from <s:CallResponder
          SrinivasAnnam Adobe Employee

          CallResponder is used to track & capture the results of asynchronous calls made to RPC based services like HTTPService, WebService, RemoteObject etc..


          Here is a quick working sample to demonstrate the use of CallResponder:


          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="400" backgroundColor="#7F7F7F" creationComplete="application1_creationCompleteHandler(event)">
             import mx.rpc.events.ResultEvent;
             import mx.events.FlexEvent;
             import mx.controls.Alert;

             protected function application1_creationCompleteHandler(event:FlexEvent):void
              updateCONVERTER_AGENTSResult2.token = hs1.send();


            <s:HTTPService id="hs1" url="http://srinivasannam.wordpress.com/feed/"/>
            <s:CallResponder id="updateCONVERTER_AGENTSResult2" result="Alert.show('Successfuly updated');"/>


          • 2. Re: How do I respond to results from <s:CallResponder
            nikos101 Level 2

            Awsome mate, your one helpful Adobe person


            I'm use to doing things manually in FB3 like so:


                <mx:RemoteObject id="myService" destination="ColdFusion" source="staff" showBusyCursor="true">

                    <mx:method name="getTargetData" result="handleGetTargetData(event)" fault="Alert.show(event.fault.message)"/>
                    <mx:method name="getTargetDataTable" result="handleGetTargetDataTable(event)" fault="Alert.show(event.fault.message)"/>      


            What advantages does this new way in using CallResponders have over my old method, apart from being auto generated?

            • 3. Re: How do I respond to results from <s:CallResponder
              nikos101 Level 2

              I've also being looking at some of the generated classes:



              * This is a generated class and is not intended for modfication.  To customize behavior
              * of this service wrapper you may modify the generated sub-class of this class - CONVERTER_AGENTSService.as.
              package services.converter_agentsservice
              import mx.rpc.AsyncToken;
              import com.adobe.fiber.core.model_internal;
              import mx.rpc.AbstractOperation;
              import valueObjects.CONVERTER_AGENTS;
              import mx.data.RPCDataManager;
              import mx.data.ManagedOperation;
              import mx.data.ManagedAssociation;
              import mx.data.ManagedQuery;
              import mx.data.ItemReference;
              import mx.collections.ItemResponder;
              import mx.rpc.remoting.RemoteObject;
              import mx.rpc.remoting.Operation;
              import com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper;
              import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
              import com.adobe.serializers.utility.TypeUtility;


              internal class _Super_CONVERTER_AGENTSService extends RemoteObjectServiceWrapper
                  private var _cONVERTER_AGENTSRPCDataManager : RPCDataManager;        
                  private var managersArray : Array = new Array();



              the code is really over my head and I wonder what is the point of it all is. Is it for perfomrance gains when using many remote services?

              • 4. Re: How do I respond to results from <s:CallResponder
                SunilAdobe Adobe Employee

                Apart from wrapping the RemoteObject, HTTPService and WebService functionality, the generated code also has capabilities to


                a. support paging of data

                b. client side data management including options for batch commits

                c. automatically deserialize XML / JSON response to AS objects in case of HTTP requests

                d. If you are using LCDS, then automatic support for associations, lazy loading


                The list is not exhaustive, but hope this helps




                • 5. Re: How do I respond to results from <s:CallResponder
                  SunilAdobe Adobe Employee

                  The old way seems to work well when there are less methods and you actually know them so that you can hand code.


                  With Data Centric Development in FlashBuilder 4, the following can be helpful


                  a. Introspection of the component, so that users need not hand code methods

                  b. The service wrapper (the _super* file) provide other functionalities as described in previous post of this thread


                  Using callresponders help in achieving a and b.


                  Would it help if we make the service call look more like a normal function call, and abstract out the call responder in the wrapper? We would like to see how developers want to see their service invocations looks like?




                  • 6. Re: How do I respond to results from <s:CallResponder
                    nikos101 Level 2

                    I feel honoured your asking me. I like seeing the complexity as I

                    think their is too much abstraction in the programming world.