2 Replies Latest reply on Jul 30, 2008 12:20 AM by smscentral

    multiple Httpservice requests

    smscentral
      Hi,

      I have a requirement where i have to load two components on one click.
      And each component has httpservice request.

      function onclick is the following

      public function onclick(event:MouseEvent):void{

      this.loadComponentOne();
      this.loadComponentTwo();

      }

      when i get the response correctly , the invoke and result events from httpservice are in this order

      Httpservice from component one in invoked
      result from component one is [object Object]

      HttpService from component two is invoked
      result from component two is [object Object]


      but sometimes there is a conflict between the responses from the httpservices of these components
      in this case,Events from httpservice output the result in this order

      Httpservice from component one in invoked
      HttpService from component two is invoked

      result from component one is [object Object]
      result from component two is [] //empty for some reaon

      i get the result from my servlet correctly but ResultEvent.result is empty

      and the component two is not loaded because the result is empty..

      so how should the multiple httprequests be handled to get the responses correctly?

      Thanks
      chandana




        • 1. Re: multiple Httpservice requests
          atta707 Level 2
          you may want to show us more code. especially the event registration and handler code.
          • 2. Re: multiple Httpservice requests
            smscentral Level 1
            I am using a separate class to create a httpservice.
            following is the code where i send the Httpservice with all the event handlers.
            and from the component i call the methods from this class to get the response as follows

            public function selectedEntitiesList(id:String):void{
            backendRequest = new MittoBackendRequest(list_url);
            backendRequest.setRequest({action:action,id:id});
            backendRequest.addEventListener(ResultEvent.RESULT,getList);
            backendRequest.send();

            }


            Thanks
            chandana