asynch web service calls

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I'm totally confused by the whole acynch process. Here is what I have and where I want to be.

...............
Code runs for a while in ASP.NET
....
Web service 1 is called
....
Web service 2 is called
....
Results of both calls are used to log something to a table


Where I want to be is this:
I want web service 1 to be started and then web service 2 to be started. Then i want to wait around for both of them to finish and then go to the results part.

I don't understand how I wait around for the results before continuing?

Any suggestions?
 
The call to the webservices should stop the code in the ASP.NET
application until a result is returned; I don't understand what
the problem is.
 
If you add a web reference to a web service .Net should also generate an Async wrapper round the call.

e.g. If the web ervice had a method Test you would also get a BeginTest / EndTest that can be used to call a web method asyncronously (sp?)
If you have a particular service in mind reply and I could suggest some code.

PS. Bucky - love your sig :D
 
I call both services asynch using the Begin method but this does not halt the execution of the code. And I thought that was the purpose of doing it asynch anyhow. The code that follows the two calls performs a function that updates an Oracle table with the results of the two web service calls. Therefore, I cannot have that code execute until the services have completed.

I did get a suggestion for what I would consider a work around:

Call both services using the Begin method with callbacks for each.
When the callbacks respond have each check the result of the other to see if it has responded yet. In this manner you can determine when the last of the two is complete. Then this would in turn call a function which contained the remainder of my code.

I consider this a work around because it entails me ripping out all of the code that used to sit below the web service calls in the same Sub and moving it to a Function and passing it all of the variables that would have been local to the original Sub.

There has to be a better way, I am just not seeing it. Someone enlighten me.
 
You could call each method in turn and then wait

i.e.
BeginMethod1
BeginMethod2

'do stuff

EndMethod1
EndMethod2

the EndXXXXX methods will block until the server returns a result.
 
Back
Top