Trying to debug a problem where asycnchronous calls made through a Flex (LiveCycle) Data Services proxy seemed to be being handled synchronously, not asynchronously, and I have basically confirmed it. In other words, if you make 5 calls through the proxy, they will be handled one after the other. My diagnosis of this involved creating a web service with a feedback method that takes a delay in seconds as a parameter. I first called it asynchronously direct from the Flex client, to confirm that it worked as expected - the first call, with a delay of 10 seconds, returns five seconds after the second call, which has a delay of five seconds. Then I switched on useProxy. The first call returns after ten seconds. Five seconds later, I get the feedback from the second call. As you can see from my code below, I tried with seperate web service objects and seperate destinations. So, is it possible to do asynchronous web service calls through data services proxy? If so, how? The only way I can think is to subclass HTTPProxyAdapter a number of times (I've already subclassed it once to get around bug BLZ-120) and initiate separate services, but I've no idea even if that would work, and it seems a ridiculous length to go to to get what you would think is default behaviour. Surely I've missed something? My test code: <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationComplete()"> <mx:Script> <![CDATA[ import mx.messaging.config.ServerConfig; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.soap.LoadEvent; import mx.rpc.soap.WebService; private var ws1 : WebService = new WebService (); private var ws2 : WebService = new WebService (); private var ws1Loaded : Boolean = false; private var ws2Loaded : Boolean = false; private function creationComplete () : void { var servConfig : XML = ServerConfig.serverConfigData; ws1.wsdl = "http://localhost:8080/delayservice/services/DelayService?WSDL"; ws1.endpointURI = "http://localhost:8080/delayservice/services/DelayService"; ws1.useProxy = true; ws1.destination="Destination1" ws1.addEventListener(LoadEvent.LOAD, ws1_load); ws2.wsdl = "http://localhost:8080/delayservice/services/DelayService?WSDL"; ws2.endpointURI = "http://localhost:8080/delayservice/services/DelayService"; ws2.useProxy = true; ws2.destination="Destination2" ws2.addEventListener(LoadEvent.LOAD, ws2_load); trace ("loading wsdls"); ws1.loadWSDL(); ws2.loadWSDL(); } private function ws1_load (event : LoadEvent) : void { trace ("ws1 loaded"); ws1.addEventListener(ResultEvent.RESULT, ws_result); ws1.addEventListener(FaultEvent.FAULT, ws_fault); ws1Loaded = true; if (ws2Loaded) makeCalls (); } private function ws2_load (event : LoadEvent) : void { trace ("ws2 loaded"); ws2.addEventListener(ResultEvent.RESULT, ws_result); ws2.addEventListener(FaultEvent.FAULT, ws_fault); ws2Loaded = true; if (ws1Loaded) makeCalls (); } private function makeCalls () : void { trace ("calling ten second feedback"); ws1.feedback ("Ten Seconds", 10); trace ("calling five second feedback"); ws2.feedback ("Five Seconds", 5); } private function ws_result (event : ResultEvent) : void { trace (event.result.toString()); } private function ws_fault (event : FaultEvent) : void { trace (event.fault.toString()); } ]]> </mx:Script> </mx:Application> ________________________________ Tim Stewart Solution Architect Tel: \+61 2 9976 4500 ext. 2032 Fax: \+61 2 9976 5055 Mobile : 0424 225924 Web: www.avoka.com Email: [EMAIL PROTECTED]
<<newavoka_logo_email.jpg>>