2 Replies Latest reply on Dec 9, 2007 10:25 AM by Tomislav Pokrajcic

    AsyncRequest forgets about AsyncResponder

    Tomislav Pokrajcic
      I'm implementing a custom service pipe (Service, Operation, Message, Channel) and I came to a confusing point with AsyncRequest and AsyncResponder.

      I have this code in my Operation class:

      var message:MyCustomMessage=new MyCustomMessage();
      var token:AsyncToken=new AsyncToken(message);
      var req:AsyncRequest=new AsyncRequest();
      req.addEventListener(MessageAckEvent.ACKNOWLEDGE,onAck);
      var responder:AsyncResponder=new AsyncResponder(this.onResult, this.onFault,
      token);
      req.invoke(message,responder);

      When server response comes nothing happens with responder (no handlers are
      called).
      However, onAck method is invoked, and contains all valid data.

      What I did for testing is - I extended AsyncRequest with following
      overrides:

      override public function acknowledge(ackMsg:AcknowledgeMessage,
      msg:IMessage):void{
      super.acknowledge(ackMsg,msg);
      this.m_responder.result(msg.body);
      }
      override public function invoke(msg:IMessage, responder:IResponder):void{
      this.m_responder=responder;
      super.invoke(msg,responder);
      }

      After that, everything works fine.
      Am I messing too much or what?
      Thnx,

      Tom