0 Replies Latest reply on Apr 22, 2008 9:15 AM by garag

    Synchronous  Flex Calls

    garag Level 1
      Hi,

      I have a question about the WebService object.

      My application needs to receive data from a WebService in synchronous way.

      I explain better the problem. I have some custom components populated by data received from Web Service.

      When the application start, the istances of the various custom components are created and each custom components calls the web service in order to populate the respective dataprovider property.

      To retrieve data, I have to add a listener to the Web Service result and then manage the result when the web service returns them. In the application start phase, I should have two custom components that can call contemporaneously the same method of the webservice and I have to manage this situation.

      I'd like to have a data access layer where each custom component access to it to obtain data.

      For example:


      Asynchronous Way


      ...
      var mycustcomp : MyCustComp = new MyCustComp ();
      addResultListeneronWebService()
      addFaultListeneronWebService()
      callWebService();
      ....


      Function to manage Result
      {
      mycustcomp.dataprovider = event.result;
      }


      Function to manage Fault
      {
      bla bla
      }



      Synchronous Way

      ...
      var mycustcomp : MyCustComp = new MyCustComp ();
      mycustcomp.dataprovider = CallSynchronousDataLayer (); ....



      Obiviously the function CallSynchronousDataLayer will call the WebService, will manage the result and then will return the data to mycustcomp dataprovider property.

      I hope that the question is clear. Is it possible to have this Synchronous behaviour in ActionScript?

      Thank you very much

      Regards