3 Replies Latest reply on Aug 14, 2007 5:16 AM by DanaB97531

    WebService Operation result event handler

    DanaB97531
      Does anyone have a suggestion for the best way to determine when the "result" event handler has completed it's processing? After I send a request to the WebService
      ws.wsMethod.send(...);
      I'd like to act on results of the event handler I defined
      <mx:operation name="wsMethod" result="wsMethodHandler(event)">
      Is there a flag or event I can wait for? Thanks!
        • 1. Re: WebService Operation result event handler
          DanaB97531 Level 1
          To clarify, If I try to act on data obtained in the event hander code, just after the send call, that data is not valid yet. I want to wait until it is valid so I can do something with it. I could use all kinds of flags but that seems like a hack.
          • 2. Re: WebService Operation result event handler
            ntsiii Level 3
            " in the event hander code, just after the send call"
            You seem confused, or have confused me.

            The function, "wsMethodHandler(event)" is called when the result is returned from the operation. You can only act on the returned data there. It is a separate function and has nothing to do at all with the send();

            Maybe post some more code.

            Tracy
            • 3. Re: WebService Operation result event handler
              DanaB97531 Level 1
              Tracy, Thank you for your reply. I am the confused one. Since my original posting, I have researched a lot about Asynchronous communications (ACT), AsyncToken, etc. I understand the basic concepts of the use of a token but the examples I have found do not give me the level of detail that I need for the proper syntax.

              I'd like to focus on 1 issue right now. Does anyone know of any good sample code I could look at that demonstrates how to use the AsyncToken to manage multiple calls to a web service through a single WebService object? I have 1 operation that I use to retrieve data from multiple sources. I want to be sure that I am processing data from the correct response.

              It has been suggested that I create a separate mx:WebService object for each type of call (and subsequently, a unique result handler. This seems inefficient to me.

              Thanks to all for your input.