Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
17Activity
0 of .
Results for:
No results containing your search query
P. 1
Web Services in Action - Himalay Majumdar

Web Services in Action - Himalay Majumdar

Ratings:

4.67

(1)
|Views: 1,776|Likes:
Published by Himalay Majumdar

More info:

Published by: Himalay Majumdar on Mar 21, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

11/08/2012

pdf

text

original

 
Web Services in Action
Web services are an important component in the J2EE platform, as they provide for loosely-coupled communication between enterprise systems. They are ideal fo
Enterprise Application Integration
(EAI), particularly those systems that have evolvedover time.
Design and Architecture
The two principal Web service models -- a document-oriented model and a RemoteProcedure Call-oriented model -- from which the synchronous and asynchronous Webservice architectures are derivedSome of the issues to be considered for designing a Web service interface, includinggranularity of services, the Java API for XML-based Remote Procedure Call (JAX-RPC),and object-centric and document-centric parameter binding. Guidelines on how toarchitect a Web service is based on receiving and responding to requests, delegating to business logic, and exposing a Web service.
When to use?
Before you even begin to design a Web service, you should decide whether you need aWeb service solution for your application. Web services should be used when you needinteroperability across
heterogeneous
platforms. That is, when you need to expose all or  part of your application to other applications on different platforms.Implementing a Web service makes sense when your application's clients are potentiallynon-J2EE applications. Even if your application's clients are all J2EE applications, youmay still want to use Web services if your clients are
scattered
across the Web. However,when clients are all J2EE applications, it may be best to use J2EE technologies and avoidthe extra performance cost of a Web service. Keep in mind that one of the key advantagesto using Web services technologies is the ability to go through
firewalls
.
Generic Web services
Generic Web services follow the
service-oriented architecture model
shown in Figure  1.1. In this model, a Web service first publishes its interface to a registry. The client thenlooks up, or discovers, the Web service from the registry. Last, the client binds to the Webservice in order to use its services. In a Java programming environment, the Web serviceuses the Java API for XML Registries (JAXR) to publish itself to the registry. The clientuses the same JAXR API to look up the service in the registry. The client uses JAX-RPCto bind to and use the Web service. SeeFigure 1.1.
 
Figure 1.1
Publish-Discover-Bind ModelWhile this architecture showcases generic Web services, when the service provider andthe client are
known
to each other, they can
bypass publish
and discover steps of the process. Instead, they can directly bind with each other and directly use each other'sservices.
This document
looks at scenarios in which the
service provider and the clientknow each other
. So no JAXR needed.Key to Web service design is how a Web service processes requests at the server side (its
processing model
) and how clients invoke and use the service (the Web service's
interaction model
).Figure 1.2shows the categorization of Web services according totheir interaction and processing models. Notice that
typical Web
 
services mix thedifferent interactions and processing models
, along with synchronous andasynchronous communication.
Figure 1.2
Web Service Models
 
A
service's processing model
may be business
object (or method) centric
or it may be
document centric
. The business
object-centric approach
is driven by a series of method calls. These method calls apply the business logic of the service to a set of  business objects containing the information required for processing the request. Anexample of an object-centric service might be a
credit card authorization
Web service.Such a service may receive the credit card details as parameters with the method calls.
The methods invoked on the service map directly to specific business logic.
The
method parameters are used to map to a particular business object (such as asession or entity object) or they are used to pass data to the business logic
.With a
document-centric Web service
, the
business logic is kept separate from thedocument content
. The service receives an XML document, and that document containsonly data and no explicit binding to the business logic that is to be applied. There is nomapping of the request to the business logic; that is, specific methods are not invoked onthe service. Instead, the Web service applies its business logic to the XML document, andthe document content determines the processing workflow. A travel agency Web serviceis a good example of a document-centric service. The service receives a request: an XMLdocument that contains the details of the desired travel itinerary -- dates, places to visit, preferred accommodations, and so forth. The travel agency service processes the requestaccording to the document content.
The interaction model encompasses the client's interaction with the Web service.
Aclient's interaction with a Web service can be
synchronous or asynchronous
, or acombination of both types of communication. (That is, some method invocations may besynchronous and others may be asynchronous.) When a synchronous model is followed,the application typically uses an RPC-oriented interaction. With this type of interaction,the client's request is mapped to a method call on the Web service's business logic on theserver. Using the credit card service as an example, the client utilizes an RPC call toinvoke a method on the credit card service's server. The client passes the method thecredit card details as an argument. The client might invoke a method to authorize use of the credit card and
pass the method an object containing the card details
, such as byinvoking the method
authorizeCreditCard(CreditCard cardDetails)
.Document-centric processing
is usually associated with an
asynchronous messaging
communication. The client's request is sent as a message. The Web service receives themessage and processes it, sending the results when it completes its processing. In the caseof the travel agency service, the details of the client's travel request are sent to the serviceas an XML document via a message (or as an attachment to an RPC call). The servicereceives the document and parses it to determine how to process the request.
The RPC-oriented and document-oriented Web services form two ends of aspectrum.
At one end, a Web service may use a totally RPC-oriented interaction modeland object-centric processing, in which case you model it as a RPC-oriented Web service.At the other end, a service may be completely document oriented and communicate withasynchronous messaging.

Activity (17)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
jaguarg liked this
Rajeev Chugh liked this
DVaranasi liked this
mike.juka liked this
vnadgir liked this
arnelsoft liked this
kraj432 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->