0 Replies Latest reply on Jan 29, 2010 11:36 AM by learningflex

    How to call a .Net webservice every 10 sec from Flex asynchronously

    learningflex

      I was able to call the webservice 10 times and then it hangs up. Let me know what i need to do.

       

       

      <mx:WebService

      id="

       

      webServiceList"

      service = "

      MyService"

      port = "

      BasicHttpBinding_SOAPService"

      destination="

      genesysWS" showBusyCursor="false"

      wsdl=

      .....MyService.svc?wsdl

      useProxy="

      true" >

       

      <mx:operation name="GetPeopleStatistics" resultFormat="object"

      fault="mx.controls.Alert.show(event.fault.faultString)"

      result="showResult(event)"

      >

       

      <mx:request>

       

       

      <peopleNames>{arrCollection}</peopleNames>

       

       

      </mx:request>

       

       

      </mx:operation>

       

       

      </mx:WebService>

       

      private

       

      function init():void{

       

       

      var refreshtimer:Timer = new Timer(10000);//call webservice every 10 sec

      refreshtimer.addEventListener(TimerEvent.TIMER,refreshTimerHandler);

      refreshtimer.addEventListener(TimerEvent.TIMER_COMPLETE,refreshTimercompleteHandler);

      refreshtimer.start();

      webServiceList.addEventListener(LoadEvent.LOAD,onWSDLLoad);

      public

       

      }

       

       

       

      function refreshTimerHandler(event:TimerEvent):void

      {

       

       

      if(loaded)

      {

       

       

      webServiceList.loadWSDL();

      webServiceList.GetPeopleStatistics.send();

      }

       

      }

       

       

      public function refreshTimercompleteHandler(event:TimerEvent):void

      {

       

      refreshtimer.reset();

      refreshtimer.start();

      }

       

       

      public function onFaultEvent(evt:FaultEvent):void

      {

       

       

      // Alert.show(evt.fault.faultString, evt.fault.faultDetail);

      Alert.show(evt.fault.message);

       

       

      trace("loading error");

      refreshtimer.stop();

       

      }

      private

       

       

       

       

       

      function onWSDLLoad(event:LoadEvent):void

      {

      loaded =

       

      loaded =

      true;

       

       

       

       

      //refreshtimer.start();

      }

       

       

      private function showQAListResult(e:ResultEvent):void

      {

       

      out= e.result

      as ArrayCollection;

      }