Presentation is loading. Please wait.

Presentation is loading. Please wait.

ADVANCED WEB SERVICES. Three Advanced Web Service Techniques SOAP Extensions Asynchronous calls Custom wire formatting SOAP Extensions Asynchronous calls.

Similar presentations


Presentation on theme: "ADVANCED WEB SERVICES. Three Advanced Web Service Techniques SOAP Extensions Asynchronous calls Custom wire formatting SOAP Extensions Asynchronous calls."— Presentation transcript:

1 ADVANCED WEB SERVICES

2 Three Advanced Web Service Techniques SOAP Extensions Asynchronous calls Custom wire formatting SOAP Extensions Asynchronous calls Custom wire formatting

3 Asynchronous Web Methods Synchronous method calls –Client waits for response before any further processing –This is default behavior in Web service clients Synchronous method calls –Client waits for response before any further processing –This is default behavior in Web service clients

4 Asynchronous Web Methods (cont’d) Asynchronous method calls –Client continues processing after issuing Web service method call –Web service does not have to be modified for asynchronous calls –Implemented on client Asynchronous method calls –Client continues processing after issuing Web service method call –Web service does not have to be modified for asynchronous calls –Implemented on client

5 Asynchronous Call Techniques Use a callback delegate Use the WaitHandle object Use a callback delegate Use the WaitHandle object

6 Callback Delegate Introduced in C++ Delegate is associated with method and with client Delegate is a communication object, linking method source with calling code Introduced in C++ Delegate is associated with method and with client Delegate is a communication object, linking method source with calling code

7 Create A Delegate // create a delegate to handle the callback AsyncCallback cb = new AsyncCallback(WebServiceCallback); // launch the asynchronous call –... // do some processing while waiting for response –... // create a delegate to handle the callback AsyncCallback cb = new AsyncCallback(WebServiceCallback); // launch the asynchronous call –... // do some processing while waiting for response –...

8 Method To Handle Response // callback to handle the async return private void WebServiceCallback (IAsyncResult ar) { –... –tbxDescription.AppendText(“response”); } // callback to handle the async return private void WebServiceCallback (IAsyncResult ar) { –... –tbxDescription.AppendText(“response”); }

9 The WaitHandle Object Allows programmer to convert an asynchronous process into a synchronous process Uses Threading –Using System.Threading; –Threading allows your program to have multiple “threads”, each thread being dispatched separately by the CLR Allows programmer to convert an asynchronous process into a synchronous process Uses Threading –Using System.Threading; –Threading allows your program to have multiple “threads”, each thread being dispatched separately by the CLR

10 The WaitHandle Object (cont’d) // create a result object to hold the status of the asynchronous call IAsyncResult ar; // launch the async call... // wait for the result to come back WaitHandle wh = ar.AsyncWaitHandle; wh.WaitOne();... // create a result object to hold the status of the asynchronous call IAsyncResult ar; // launch the async call... // wait for the result to come back WaitHandle wh = ar.AsyncWaitHandle; wh.WaitOne();...

11 Selected WaitHandle Methods WaitOne(); WaitAny(); WaitAll(); WaitOne(); WaitAny(); WaitAll();


Download ppt "ADVANCED WEB SERVICES. Three Advanced Web Service Techniques SOAP Extensions Asynchronous calls Custom wire formatting SOAP Extensions Asynchronous calls."

Similar presentations


Ads by Google