I need to call a 3rd party web service from within a console application using the asynchronous method provided by their API. I'm using the old ASMX web reference way to generate a proxy.
I have a class that does the following operations and I want to create an instance of it, make the call to the service with it, but then I want to wait for the completion of the callback and only then repeat with a new instance, new call, new callback etc.
I do not want to have more than 1 call active at a time. i.e. only 1 instance of the class will exist at a time.
The web service calling code looks like this:
using(ABCWebService service = new ABCWebService())
{
...
service.ExecuteCallAndWaitResultCompleted += service_ExecuteCallAndWaitResultCompleted;
service.ExecuteCallAndWaitResultAsync(parm1, parm2, .., stateObj);
}
...
The callback looks like this:
void service_ExecuteCallAndWaitResultCompleted(object sender, ExecuteCallAndWaitResultCompletedEventArgs e)
{
// collect data and then move onto next sequential call
}