0 Replies Latest reply on Aug 3, 2006 5:29 PM by gumnam

    WbeService not queing calls automatically

      Hi .
      I am using Flex 2 framework through Flex Builder 2. I do not use Flex Data Services. I am instantiating webservice in actionscript. Here is the code that I use to do this:

      var wsdl:String = "mywsdl..." ;
      var service:WebService = new WebService();
      service.useProxy = false ;
      service.addEventListener(mx.rpc.events.FaultEvent.FAULT , faultCallBack);
      service.addEventListener("load" , addHeaders);
      service.addEventListener("result" , loadAlarms);
      var op:AbstractOperation = service.getOperation("selectAlarmsWithoutHistoryForEntityIDs");

      op.send([uuid, startDate,endDate,pw );

      Now the problem is that the operation is getting invoked before the webservice has loaded. SO when the operation is called the headers are not added to the service yet and hence the remote server returns fault since it can not find authentication parameters.

      Previously in Flex 1.5 all the pendingCalls were getting queued and this was taken care of automatically. Does anybody know how to fix this ?

      One thing I can do is that I can add event listener for the service's load event and only invoke the operation within that load handler , but I have a serviceLocator which is responsible for returning the service , so it might be already loaded in somecases and in some cases it might yet not be loaded. SO in the case the service has already been loaded by previous call to ServiceLocator 's getService method then the operation will never be invoked.