1 Reply Latest reply on Oct 21, 2009 2:15 AM by KostyaN777

    How to handle multiple SOAP requests for ArrayCollection initialization?

    KostyaN777

      Hello.

      I want to initialize some ArrayCollection with objects, which receive field values via SOAP requests (in getUdfValuePrj function).

       for (var i:int=0; i < data.length; i++)
       {
        var task:Task=new Task();
        task.laborio = getUdfValuePrj(data[i].id, LABORIOUSNESS);
       }
       tempTaskArray.addItem(task);
      

       

       

      Here is my WebService:

       private function initWebServices(wsdl:String):void
           {
        _udfWs = new WebService();
        _udfWs.wsdl = wsdl;
        _udfWs.getTaskUDFValue.addEventListener("result",
        getTaskUDFValueResult);
        _udfWs.getTaskUDFValue.addEventListener("fault", handleFault);
        _udfWs.loadWSDL();
       }


      The question is, how functions getUdfValuePrj and getTaskUDFValueResult should look like?

       

      I think that is no good:

       

      private function getTaskUDFValueResult(event:ResultEvent):String
       {
        _udfValue = event.result as String;
       }
      
      
      private function getUdfValuePrj (taskId:String, udfCaption:String):String
       {
        _udfValue = "Loading...";
        _udfWs.getTaskUDFValue (taskId,udfCaption);
        while (_udfValue == "Loading...")
        {
        }
        return _udfValue;
       }