Why Wait for Asynchronous Web Services Calls

.net, asp.net, asynchronous, c#, web-services

Solution

To be useful, the asynchronous call needs to do its thing while you go do something else. There are two ways to do that:

Provide a callback method for the asynchronous handle, so that it can notify you when it is completed, or

Periodically check the asynchronous handle to see if its status has changed to "completed."

You wouldn't use a WaitHandle to do these two things. However, the WaitHandle class makes it possible for clients to make an asynchronous call and wait for:

- a single XML Web service (`WaitHandle.WaitOne`),

- the first of many XML Web services (`WaitHandle.WaitAny`), or

- all of many XML Web services (`WaitHandle.WaitAll`)

to return results.

In other words, if you use `WaitOne` or `WaitAny` on an asynchronous web service that returns several results, you can obtain a single result from your web service call, and process it while you are waiting on the remaining results.

Problem

I was going through MSDN documentation on WebServices. Here and here, both these links talk about calling a webservice and wait for the response, which is also a general trend that I have seen while asynch implementation. I don't understand "why do we need to wait for service call to return"? And, if we are waiting why don't make an synchronous call. What is the difference between an "asynch call followed by wait" and a "synchronous call"?

Original source