asynchronous web services n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Asynchronous Web Services PowerPoint Presentation
Download Presentation
Asynchronous Web Services

Loading in 2 Seconds...

play fullscreen
1 / 18

Asynchronous Web Services - PowerPoint PPT Presentation


  • 63 Views
  • Uploaded on

Asynchronous Web Services. Jaliya N. Ekanayake. Basics of Web Services. Simple Web Service Invocations. Example of Synchronous Service Invocation. Service takes some time to complete Client is waiting for the response Example of Asynchronous Service Invocation

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Asynchronous Web Services' - thomas-kirby


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
asynchronous web services

Asynchronous Web Services

Jaliya N. Ekanayake

simple web service invocations
Simple Web Service Invocations
  • Example of Synchronous Service Invocation.
    • Service takes some time to complete
    • Client is waiting for the response
  • Example of Asynchronous Service Invocation
    • Service takes some time to complete
    • Client is waiting for the response
some use cases
Some Use Cases
  • Time consuming web services
    • long-lived operations
      • batch processing
      • peer to peer programs
      • event driven application models.
    • Web services that leverage The client can be a Reactive Application
      • Client can be a server to some other clients. So the blocking is not acceptable.
some use cases contd
Some Use Cases contd..
  • User may not need to wait for the responses
    • User is doing some batch submission.
    • E.g. A bank submitting credit card information to a service provider.
  • User can check for responses after sending few invocations.
    • The response from a service represents a collective information.
  • User need the response after some time.
    • E.g. A batch submission process, the result will be available in the next day.
supporting the asynchrony
Supporting the Asynchrony
  • Protocol level asynchrony
    • E.g. JMS can be used to invoke the services asynchronously.
      • Client subscribes to a topic and return
      • Response will be delivered to client through the JMS Queue
  • Client Asynchrony Patterns
    • Fire and Forget
    • Callbacks
    • Polling
  • Service Asynchrony
client side asynchrony

Client Machine

Server

1 Invoke

2 Send

Client

Proxy

Client

Service

3 Return

Client Side Asynchrony
  • Fire and Forget.
    • Invokes the service and return immediately without ever bothering about a response.
  • Issues
    • No waiting. Client can immediately resume the thread.
    • Easy for the developers
    • Loosely coupled
    • No way to verify whether the request has been sent or not.
fire and forget
Fire and Forget
  • Code Snippet
  • Example>>
client side asynchrony1

Client Machine

Server

2 Send

1 Invoke

Client

Proxy

Client

Service

3 Return

a Poll Object

Polling and getting back the result

Poll Object

Set the Response

Client Side Asynchrony
  • Polling
    • Client repeatedly poll for the availability of the results, while performing some other task.
  • Issues
    • Client has to wait polling
    • Client has to handle the complexity of this polling operation
    • Response can be retrieved asynchronously
polling
Polling
  • Code Snippet
  • Example>>
client side asynchrony2

Client Machine

Server

3 Send

2 Invoke

Client

Proxy

Client

Service

1 Creates a Callback Object

Callback

4 Response is dispatched

to the callback by the client proxy

Client Side Asynchrony
  • Result Callbacks
    • Client provides a callback method. Proxy will dispatch the result using the callback method.
  • Issues
    • Client has to provide the callback method
    • Client has to handle the additional complexity
    • Response can be retrieved asynchronously
callback
Callback
  • Code Snippet
  • Example>>
asynchronous web service model
Asynchronous Web Service Model
  • The service does not “return” anything.
  • It can send the response (if any) by itself.
  • Transport may or may not be synchronous
    • E.g. 1 (HTTP Transport)
      • Service has a void return type and it will send a response after a while using different HTTP connection
    • E.g. 2 (One way transport -JMS)
      • Service sends a response using a new one way transport.
  • What is required.
    • Service should have the capability to send the response by itself.
    • Client should be able to correlate the request and the response
    • Client should have an addressable endpoint.
  • Can use WS-Addressing <wsa:relatesTo> for standard correlation.
asynchronous web service model contd

Client

Sender

M

Service

Receiver

M

Asynchronous Web Service Model contd..
  • The model
  • Features
    • Service sends the response by itself.
    • Correlation information contains in the SOAP message itself.
    • Client has both a Sender and a Receiver.
support from the existing technologies
Support from the Existing Technologies
  • Microsoft .NET supports the client side asynchrony.
  • With the WSE 2.0 the service asynchrony is also supported.
  • Systinet WASP supports the client side asynchrony and WS-Addressing.
  • Axis 2 (Currently under development) will support both.
summery
Summery
  • There are many advantages of using asynchronous patterns in implementing web services for B2B, EAI scenarios.
  • Client Side Asynchrony
    • Fire & Forget
    • Polling
    • Callbacks
  • Service Asynchrony
  • Technology support
references
References
  • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmaj/html/aj2mpsoarch.asp
  • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconinvokingwebservicesasynchronously.asp
  • www.fawcette.com/xmlmag/ 2003_02/magazine/practice/dchappell/
  • http://www.c-sharpcorner.com/Code/2004/April/AsyncWebServices.asp
  • http://www.esecurityplanet.com/prodser/article.php/2235201
  • http://xml.coverpages.org/ni2004-04-15-a.html