PDA

View Full Version : Problem with web services


mitro
07-27-2009, 01:43 PM
Hello,

I am relatively new to web services and flex and recently I encountered the following problem.

I have several web services I wish to execute one after another where each waits for the previous to finish.

For example:
Login("test")
doSomething("test1")
doSomething("test2")
Logoff("test")

I've found in the online documentation of flex that in order to do this I have to call the next web service I wish to execute next from the result handler of the previous one.

(Here's the link: http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=dataservices_099_23.html )

So what I did was create a function UseWebservice(String s) which I call after clicking a button. According to the parameter s of the function I call the web service I wish to execute and in the result handler of the web service I call recursively UseWebservice(String s) but with another argument. The problem is I can't get it to work correctly and was wondering if my idea is correct, and if it's not is there another way I can do this?

Thank you