2 Replies Latest reply on Jul 27, 2011 8:26 AM by stickamw

    Remote Object Result Handler Never Fires

    stickamw

      Hi Guys,

       

           Have a rather unusual one here...one that has got me thoroughly stumped.

       

           THE SETUP:

       

           We are using BlazeDS for our middle layer.  In my UI, I have a simple Remote Object and method declaration with a result handler:

       

              <mx:RemoteObject id="remoteServices" showBusyCursor="true" destination="apmWebService" >
                  <mx:method name=... />
                  <mx:method name=... />
                  <mx:method name=... />
                  <mx:method name=... />
                  <mx:method name="addWrapupCodeByAgentLogin" result="addWrapupResult(event)" fault="remoteServicesFault(event)" />
              </mx:RemoteObject>

       

           Then I have the following result handler:

       

                  private function addWrapupResult(event:ResultEvent):void
                  {
                      alert.info("Finally in the result handler");
                      remoteServices.anotherMethodCall;
                  }

       

           THE PROBLEM:

       

                When the method for the addWrapup code is called, it fires but the result handler is NEVER invoked.  We see the data added to the database and have even gone through Wireshark and watched the BlazeDS return a value back thru the pipe...as well as watched flashbug to see the AMF data come back but no matter what I've tried (including cleaning the project and completely re-writing the method) I cannot seem to get the result handler hit.  Furthermore, I know it's not a connectivity issue because ALL of the other result handlers for all of our other methods work fine.

       

                So does anyone have any ideas on why the result handler would not fire? It's almost as if the logic gets lost between the blaze and the flex UI on the return leg of the method call.

       

      Thanks in advance,

      Adrian

        • 1. Re: Remote Object Result Handler Never Fires
          Mattr1981

          Use an AsyncToken to fire the method.

           

          <s:RemoteObject id="remoteServices" showBusyCursor="true" destination="apmWebService" fault="mainComFault" >
          <s:method name="addWrapupCodeByAgentLogin"/>
          </s:RemoteObject>

           

          maybe on a button, or init or creationcomplete

           

          var yourToken:AsyncToken = remoteServices.addWrapupCodeByAgentLogin();

          yourToken.addResponder(new mx.rpc.Responder(tokenResult, tokenFault));

           

          then your code:

           

          private function tokenResult(event:ResultEvent):void
          {
          alert.info("Result");
          remoteServices.anotherMethodCall;
          }

           

          private function tokenFault(event:FaultEvent):void
          {
          alert.info("Fault in the data");
          remoteServices.anotherMethodCall;
          }

           

          private function mainComFault(event:FaultEvent):void
          {
          alert.info("Fault comming with Remote Service");
          }

           

          I have also noticed you do nothing with your result ? Why is this?

          • 2. Re: Remote Object Result Handler Never Fires
            stickamw Level 1

            Most excellent!  This worked perfectly.  I'd really love to know why this one remote object method had to be treated this way whilst all the others worked fine.  Very strange indeed.

             

            As far as the your question, this method only returns a 1 or a 0 depending on the success of the db add.  For my testing and troubleshooting, I pulled out all the extra code and just put a couple of basics in to see if we were getting anywhere.

             

            Thanks!

            Adrian