3 Replies Latest reply on Mar 11, 2009 10:41 AM by JeffreyGong

    "result" is never called on mx:RemoteObject

    univold
      Hello, All.
      I faced with the strange problem regarding getting result of Method invocation on the RemoteObject.
      I have BlazeDS on server side configured and everything was working fine when server returns a Collection of Objects.
      But now I'm trying to receive one Object, defined on server side as:

      @ActionScript( bindable = true)
      public class PageHolder<T,U> {

      private List<T> valueList;
      private U firstRowId;
      private U lastRowId;
      // ...... getters setters
      }


      On client I have the mapped object:

      [Bindable]
      [RemoteClass(alias="com.dummy.PageHolder")]
      public class PageHolder extends PageHolderBase
      {
      private var _firstRowId : Object;

      private var _lastRowId : Object;

      private var _valueList : ArrayCollection;
      }


      The remote object defenition is:

      <mx:RemoteObject id="searchService" destination="searchService" fault="faultHandler(event);">
      <mx:method name="findCustomers" result="findCustomersResult(event)" fault="faultHandler(event);"/>
      </mx:RemoteObject>


      and methods are:

      public function findCustomers():void {
      try {
      searchService.searchCustomerData();
      } catch (e:Error) {
      Alert.show("after: " + e.message );
      }
      }

      public function findCustomersResult(event:ResultEvent):void {
      Alert.show("result!");
      page = event.result as PageHolder;
      }


      So, the problem is that findCustomersResult function is never called.
      At the same time I have no errors in any logs, and I see debug messages from BlazeDS, that everything is fine:

      [BlazeDS]03/11/2009 09:51:56.505 [DEBUG] [Endpoint.AMF] Serializing AMF/HTTP response
      Version: 3
      (Message #0 targetURI=/2/onResult, responseURI=)
      (Externalizable Object #0 'DSK')
      (Typed Object #1 'com.dummy.PageHolder')
      firstRowId = "frid"
      valueList = (Externalizable Object #2 'flex.messaging.io.ArrayCollection')
      (Array #3)
      [0] = (Typed Object #4 'com.dummy.CustomerTransfer')
      firstRowId = null
      zip = null
      lastName = "lastboo"
      username = null
      userNo = null
      name = null
      firstName = "boo"
      lastRowId = null
      lastRowId = "lid"

      I would very appreciate if someone could help me.
      Thanks in advance.
        • 1. Re: &quot;result&quot; is never called on mx:RemoteObject
          Level 7

          "univold" <webforumsuser@macromedia.com> wrote in message
          news:gp8447$t6b$1@forums.macromedia.com...
          > Hello, All.
          > I faced with the strange problem regarding getting result of Method
          > invocation
          > on the RemoteObject.
          > I have BlazeDS on server side configured and everything was working fine
          > when
          > server returns a Collection of Objects.
          > But now I'm trying to receive one Object, defined on server side as:
          >
          > @ActionScript( bindable = true)
          > public class PageHolder<T,U> {
          >
          > private List<T> valueList;
          > private U firstRowId;
          > private U lastRowId;
          > // ...... getters setters
          > }

          >
          > On client I have the mapped object:
          >
          > [Bindable]
          > [RemoteClass(alias="com.dummy.PageHolder")]
          > public class PageHolder extends PageHolderBase
          > {
          > private var _firstRowId : Object;
          >
          > private var _lastRowId : Object;
          >
          > private var _valueList : ArrayCollection;
          > }

          >
          > The remote object defenition is:
          >
          > <mx:RemoteObject id="searchService" destination="searchService"
          > fault="faultHandler(event);">
          > <mx:method name="findCustomers"
          > result="findCustomersResult(event)"
          > fault="faultHandler(event);"/>
          > </mx:RemoteObject>

          >
          > and methods are:
          >
          > public function findCustomers():void {
          > try {
          > searchService.searchCustomerData();
          > } catch (e:Error) {
          > Alert.show("after: " + e.message );
          > }
          > }
          >
          > public function
          > findCustomersResult(event:ResultEvent):void {
          > Alert.show("result!");
          > page = event.result as PageHolder;
          > }

          >
          > So, the problem is that findCustomersResult function is never called.
          > At the same time I have no errors in any logs, and I see debug messages
          > from
          > BlazeDS, that everything is fine:

          Is your faultHandler code called?


          • 2. Re: &quot;result&quot; is never called on mx:RemoteObject
            univold Level 1
            No,
            I have no faults (fault handler is not called). Everything looks fine, but does not work :(
            • 3. Re: &quot;result&quot; is never called on mx:RemoteObject
              JeffreyGong
              Hi univold,

              You may need to change all three "private" to "public" in your AS PageHolder like

              public var _firstRowId : Object;
              public var _lastRowId : Object;
              public var _valueList : ArrayCollection;

              Lucky!

              Jeffrey