What should you do?

You are writing an application that calls a Web service.
The application must call the Web service asynchronously and also perform a small amount of processing while the Web service is running.
The return value from the Web service is required for additional processing.
You need to ensure that the application can call the Web service asynchronously and also process the return value.
Your solution must keep processor cycles to a minimum.

What should you do?

You are writing an application that calls a Web service.
The application must call the Web service asynchronously and also perform a small amount of processing while the Web service is running.
The return value from the Web service is required for additional processing.
You need to ensure that the application can call the Web service asynchronously and also process the return value.
Your solution must keep processor cycles to a minimum.

What should you do?

A.
Implement the Web service call as follows:
ProcessService serviceProxy = new ProcessService();
IAsyncResult asyncResult = serviceProxy.BeginProcess(data,null,null);
string ret = serviceProxy.EndProcess(asyncResult);
PerformProcessing();
PerformAdditionalProcessing(ret);

B.
Implement the Web service call as follows:
ProcessService serviceProxy = new ProcessService();IAsyncResult asyncResult =
serviceProxy.BeginProcess(data,null,null);
PerformProcessing();
string ret = serviceProxy.EndProcess(asyncResult);
PerformAdditionalProcessing(ret);

C.
Implement the Web service call as follows:
ProcessService serviceProxy = new ProcessService();
IAsyncResult asyncResult = serviceProxy.BeginProcess(data, new AsyncCallback(ProcessHandler),serviceProxy);
PerformProcessing();
PerformAdditionalProcessing(this.ret);

D.
Implement the Web service call as follows:
ProcessService serviceProxy = new ProcessService();
IAsyncResult asyncResult = serviceProxy.BeginProcess(data,null,null);
PerformProcessing();
while (!asyncResult.IsCompleted){ }
string ret = serviceProxy.EndProcess(asyncResult);
PerformAdditionalProcessing(ret);



Leave a Reply 0

Your email address will not be published. Required fields are marked *