Ok, all that may have some value, but is it way more complicated than it needs to be.
Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of app.developer Sent: Wednesday, September 17, 2008 10:51 AM To: [email protected] Subject: [flexcoders] Re: Multiple webservice calls (NOTE: I wrote this with the ability of italics so it may be a wee bit confusing reading this.) Assumptions: You are calling the same WS method with different parameters. Possible situation: You have a Zoo application in your Flex / AIR application. Lets say a zoo visitor is at the base state of your zoo when he/she may click on any section of the zoo. 1) From the MXML page :: CLICK on the selection (Ex: AnimalSelector.MXML) 2) Dispatch an Event as the AnimalSelectionEvent AnimalSelectionEvent is a custom event to carry data dispatchEvent(new AnimalSelectionEvent(SELECT_ANIMAL, animalSelection); 3) The registered mediator to the MXML page "hears" the event in the mediator registered to the MXML page In the mediator constructor add an event listener addEventListener( AnimalSelector.SELECT_ANIMAL, selectAnimal ); private function selectAnimal (event:AnimalSelectionEvent) : void { sendNotification( ApplicationFacade.ANIMAL_INFORMATION_REQUEST, event.animalID ); } 4)Each notification will be "heard" by a command file AnimalCommand.as switch(notification.getName()) { case ApplicationFacade.ANIMAL_INFORMATION_REQUEST: proxy.loadAnimalInformation(notification.getName()); break; } 5) Call the WS through the AnimalProxy Build the URL for the WS call Build the data parameters into an object Send the parameters to ServiceProxy 6) call the WS ServiceProxy Define the send method [Post || Get] var service:HTTPService = new HTTPService; service.method = sendMethod; service.showBusyCursor = true; service.url = url; var token:AsyncToken = service.send(fullParams); token.addResponder(responder); "responder" is the AnimalProxy so the WS knows where to send the results 7) AnimalProxy should have a "results" method to received the data back from the WS Place the data in a dataProvider ***Rinse and Repeat Time*** 8) From AnimalProxy...still in the Results method Send a notification for the next WS call (Basically do steps 3- 7 how ever many times you need to call the WS) sendNotification( ApplicationFacade.ANIMAL_HABITAT_REQUEST, animalID ); THE END :) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send a call to the WS to get animal information, habitat, and diet. All of theses can be called from the same WS and the same method with different parameters. URL: http://localhost:8080/services/getAnimalDetails <http://localhost:8080/services/getAnimalDetails> Animal information WS call: http://localhost:8080/services/getAnimalDetails? <http://localhost:8080/services/getAnimalDetails?> animal=lion&data=information Animal habitat WS call: http://localhost:8080/services/getAnimalDetails? <http://localhost:8080/services/getAnimalDetails?> animal=lion&data=habitat Animal diet WS call: http://localhost:8080/services/getAnimalDetails?animal=lion&data=diet <http://localhost:8080/services/getAnimalDetails?animal=lion&data=diet> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "florian.salihovic" <[EMAIL PROTECTED]> wrote: > > Thanx for the info, > > i'll look deeper into the informations rigt after sending this post (i would appreciate if you > could post some further informations). > > @Tracy > By "it didn't seem to work" i meant that the ready property was false after sending a > request. By concurrentyl i mean having one Web Service instance which can call multiple > operations without canceling the previous and let all calls be managerable (in a sence of > be able to differentiate between the single results that come in). > > > Best regards and thanx for the info so far. > > > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "app.developer" <appdeveloper@> wrote: > > > > Look up AsyncToken. This extend the EventDispatcher. > > > > This class provides a place to set additional or token-level data for > > asynchronous RPC operations. It also allows an IResponder to be > > attached for an individual call. > > > > Associate this to the SEND.... > > var token:AsyncToken = service.send(Params); > > token.addResponder(responder); > > > > The 'responder' will let your WS know where to return the results. > > > > I can write a longer answer after EOB. > > > > PCC > > > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "florian.salihovic" > > <florian.salihovic@> wrote: > > > > > > I'm currently trying to call with one WebService instance a WebService > > > several time concurrently. But it seems like it won't work. Is there a > > > way to achieve it? > > > > > > I'm using an instance of mx.rpc.soap.WebService. > > > > > > Any help would be appreciated. > > > > > >

