WSPPT Unit 1-4
WSPPT Unit 1-4
WSPPT Unit 1-4
Unit 1 Syllabus
Evolution and emergence of Web Services
Evolution of Distributed computing
Core Distributed Computing Technologies-
Client Server ,CORBA, JAVA RMI ,Microsoft DCOM,MOM
Challenges in Distributed Computing
Role of J2EE and XML in Distributed Computing
Emergence of Web Services and Service oriented Architecture(SOA)
Introduction to Web Services
The definition of Web Services
Basic operational model of Web Services
Tools and technologies enabling Web Services
Benefits and challenges of using Web Services
Web Services Architecture
Web Services Architecture and its characteristics
Core building blocks of Web Services
Standards and technologies for implementing Web Services
Web Services communication model
Basic steps of implementing Web Services
Evolution of DISTRIBUTED COMPUTING
“Distributing Computing is a type of computing in
which
different components and objects comprising an
application can be located on different
computers connected to network
.
Higher productivity and lower development cycle time. By
breaking up large problems into smaller ones, these individual
components can be developed by smaller development teams in
isolation.
The application client in this model handles most of the business processing
and provides the graphical user interface of the application.
It is a very popular design in business applications where the user interface
and business logic are tightly coupled with a database server for handling
data retrieval and processing.
For example, the client-server model has been widely used in enterprise
resource planning (ERP), billing, and Inventory application systems where a
number of client business applications residing in multiple desktop systems
interact with a central database server
Some of the common limitations of the client-server
application model are as follows:
The ORB intercepts the client’s call and is responsible for finding
its server object that implements the request, passes its parameters,
invokes its method, and returns its results to the client.
IDL
CORBA uses IDL contracts to specify the application
boundaries and to
establish interfaces with its clients.
The IDL provides a mechanism by which the distributed
application component’s interfaces, inherited classes, events,
attributes, and exceptions can be specified in a standard
definition language supported by the CORBA ORB
ORB.
It acts as the object bus or the bridge, providing the
communication infrastructure to send and receive
request/responses from the client and server
Network transparency
Dynamic invocation
interface
RMI client
RMI stub.
RMI infrastructure
RMI skeleton
RMI server.
Although RMI had inherent advantages provided by the distributed object
model of the Java platform, it also had some limitations:
RMI is limited only to the Java platform. It does not provide language
independence in its distributed model as targeted by CORBA.
Platform lock-in
State management
Scalability
Complex session
management issues
Message-Oriented Middleware
The first generation of Internet servers was based upon Web servers that
hosted static Web pages and provided content to the clients via
HTTP(Hyper Text Transfer Protocol).
XML, with its incredible flexibility, also has been widely adopted
and accepted as a standard by major vendors in the IT industry
The Emergence of Web Services
2.The service provider registers its business services with descriptions using a
public or private registry. The registry stores the information about the services
exposed by the service provider.
3.The customer discovers the Web services using a search engine or by locating
it directly from the registry and then invokes the Web services for performing
travel reservations and other functions over the Internet using any platform or
device.
Web-based B2B communication has been around for quite some time.
These Web-based B2B solutions are usually based on custom and proprietary
technologies and are meant for exchanging data and doing transactions over
the Web.
For example, in B2B communication, connecting new or existing
applications and adding new business partners have always been
a challenge.
Ideally, the business applications and information from a partner
organization should be able to interact with the application of the
potential partners seamlessly without redefining the system or its
resources.
Web services use industry-standard protocols like HTTP, and they can
be easily accessible through corporate firewalls.
Web services are dynamically located and invoked from public and
private registries based on industry standards such as UDDI and
ebXML
Basic Operational Model of Web Services
Service requestor. The service requestor is responsible for the service invocation. The
requestor locates the Web service using the service broker, invokes the required
Core Web Services Standards&Technologies
The five core Web services standards and technologies for building and
enabling Web services are XML, SOAP, WSDL, UDDI, and ebXML
XML uses Unicode, and it is structured self-describing neutral data that can
be stored as a simple text document for representing complex data and to
make it readable.
Today, XML is the de facto standard for structuring data, content, and data
format for electronic documents. It has already been widely accepted as
the universal language for exchanging information between applications,
systems, and devices across the Internet
In the core of the Web services model, XML plays a vital role as the
common wire format in all forms of communication. XML also is the
basis for other Web services standards
Simple Object Access Protocol (SOAP)
In the core Web services model, UDDI provides the registry for Web services to
function as a service broker enabling the service providers to populate the
registrywithservicedescriptions and service types and the service requestors to
query the registry to find and locate the services.
ebXML Messaging Service Handler (MSH) deals with the transport, routing,
Web Services Software and Tools
Web services software and tool vendors offering solutions for developing and deploying
Java-based Web services solutions. The following is a list of the most popular software
solutions commercially available for implementing Web services
The BEA Web Logic Integration Server also enables complex Web
services to be deployed with transactional integrity, security, and
reliability while supporting the emerging ebXML and BTP
standards.
Cape Clear Products
Cape Clear provides Web services infrastructure and product solutions such as
Cape Connect and Cape Studio, which enable the development of
Web services solutions based on industry standards such as XML, SOAP,
WSDL, and UDDI
IBM Products
IBM also provides a Web Services Tool Kit (WSTK) bundle (now part of Web
Sphere Studio) for developers as a runtime environment that creates, publishes,
and tests Web services solutions based on open standards such as XML,SOAP,
WSDL, and UDDI.
IOPSIS Products
It also provides tools for the deployment of Web Services to popular J2EE-based
Web application servers.
Oracle Products
Oracle’s Oracle9i Release 2 application server provides the J2EE-based
infrastructure solution for Web services supporting Web services standards
including SOAP, UDDI, and WSDL.
It also has features that define and coordinate business processes using Web
services integrating legacy applications and back-end systems.
Sun Products
As part of the Java community process, Sun has already released its Java
and XML technology-based APIs and its implementation referred to as
JAX Pack for developing and testing Java and open standards-based Web
services solutions.
Systinet Products
Web services present some key challenges associated with the mission-critical
business requirements. Some of the key challenges are as follows:
Distributed transactions.
If the environment requires distributed transactions with heterogeneous
resources, it should be studied and tested with standard solutions based on BTP,
WS- Transactions, and WS-Coordination.
Quality of Service (QoS)
In case of a mission-critical solution, the service providers must examine the
reliability and performance of the service in peak load and uncertain conditions
for high availability. The exposed infrastructure must provide load balancing, and
failover and fault tolerance, to resolve these scenarios
Security.
Web services are exposed to the public using http-based protocols. As Web
services is publicly available, it must be implemented using authentication
and authorization mechanisms and using SSLenablingencryption of the
messages for securing the usage. Adopting open security standards like
SAML, XML Encryption, XMLSignature, or XACML may be a solution.
Web Services Architecture
and Its Core Building Blocks
The basic principles behind the Web services architecture are based on
SOA and the Internet protocols. It represents a composable application
solution
based on standards and standards-based technologies
To enable the publishing of services to one or more public or private directories, thus
enabling potential users to locate the published services using standard-based
mechanisms that are defined by standards organizations
Services registry. The services registry hosts the published services and acts as a broker
providing a facility to publish and store the description of Web services registered by
the service providers. In addition, it defines a common access mechanism for the
service requestors for locating the registered services
Services delivery. It acts as the Web services client runtime environment by looking
up the services registries to find the required services and invoking them from the
service provider. It is represented as a presentation module for service requestors, by
exposing the appropriate interfaces or markups for generating content and delivery
to a variety of client applications, devices, platforms, and so forth
• ebXML
Simple Object Access Protocol (SOAP)
The Simple Object Access Protocol, or SOAP, plays the role of the messaging
protocol for exchanging information between the service provider and
the service requestor. It consists of the following:
1The service provider creates the Web service typically as SOAP based service
interfaces for exposed business applications. The provider then deploys them in
a service container or using a SOAP runtime environment, and then makes them
available for invocation over a network.
5.Using the binding information, the service requestor then invokes the
service provider and then retrieves the WSDL Service description for
those registered services. Then, the service requestor creates a client
proxy application and establishes communication with the
service provider using SOAP.
1.Using those SOAP-based interfaces, the service container handles all the
incoming SOAP requests/responses or messaging-based operations and
maps them as methods and arguments of the underlying business
application
2.WSDL-based service descriptions will be generated and then reside in a
service container. WSDL defines the communication contract required for
invoking the SOAP-based service interfaces.
3.The service requester finds the services using the discovery mechanisms
(registry API) and obtains the service description and its provider location
URL. It then connects to the service provider to obtain WSDL
In the scenario in Listing 4.1, the SOAP message is embedded in an HTTP request for
getting the book price information from www.wiley.com for the book Developing Java
Web Services.
Listing 4.2 shows the SOAP message embedded in an HTTP response
returning the price of the book
In Listing 4.2, you might have noticed that the SOAP message contains a
SOAP Envelope SOAP-ENV: Envelope as its primary root element, and it relies on
defined “XML Namespaces” commonly identified with a keyword xmlns and specific
prefixes to identify the elements and its encoding rules. All the elements in the
message are associated with SOAP-ENV-defined namespaces
Note that a SOAP application should incorporate and use the relevant SOAP
namespaces for defining its elements and attributes of its sending messages;
likewise, it must be able to process the receiving messages with those specified
namespaces.
These namespaces must be in a qualified W3C XML Schema, which facilitates the
SOAP message with groupings of elements using prefixes to avoid name
collisions.
Usually a SOAP message requires defining two basic namespaces: SOAP
Envelope and SOAP Encoding. The following list their forms in both versions
1.1 and 1.2 of SOAP.
SOAP ENVELOPE
http://schemas.xmlsoap.org/soap/envelope/ (SOAP 1.1)
http://www.w3.org/2001/06/soap-envelope (SOAP 1.2)
SOAP ENCODING
Structure of a SOAP
message
The structural format of a SOAP message (as per SOAP version 1.1
with attachments )contains the following elements:
Envelope
Header (optional)
Body
Attachments (optional)
Figure 4.1 represents the structure of a SOAP message with attachments. Typically, a
SOAP message is represented by a SOAP envelope with zero or more attachments.
The SOAP message envelope contains the header and body of the message, and the
SOAP message attachments enable the message to contain data, which include
XML and non-XML data (like text/binary files). In fact, a SOAP message package
is constructed using the MIME Multipart/Related structure approaches to separate
and identify the different parts of the message.
SOAP Envelope
A SOAP envelope contains a SOAP body as its child element, and it may contain
one or more optional SOAP body block entries
The Body represents the mandatory processing information or the payload intended
for the receiver of the message.
Listing 4.5 illustrates a SOAP body representing an RPC call for getting the
book price information from www.wiley.com for the book name
Developing Java Web Services
SOAP Attachments
The SOAP encoding defines a set of rules for expressing its data types. It is a
generalized set of data types that are represented by the programming languages,
databases, and semi-structured data required for an application. SOAP encoding also
defines serialization rules for its data model using an Encoding Style attribute under
the SOAP-ENV namespace that specifies the serialization rules for a specific
element or a group of elements.
The definition of simple type values is based on the “W3C XML Schema, Part -2:
Datatypes” specification. Examples are primitive data types such as string, integer,
decimal, and derived simple data types including enumeration and arrays. The
following examples are a SOAP representation of primitive data types:
<int>98765</int>
<decimal> 98675.43</decimal>
<string> Java Rules </string>
The derived simple data types are built from simple data types and
are expressed in the W3C XML Schema.
Enumeration
Enumeration defines a set of names specific to a base type. Listing 4.12 is
an example of an enumeration data type expressed in a W3C XML Schema
Array of Bytes
Listing 4.13 is an example of an array data type of an array of binary data that
is represented as text using base64 algorithms and expressed using a
W3C XML Schema.
Polymorphic Accessor
Structure Types
Listing 4.14 is an XML Schema of the Structure data type representing the
“Shipping address” with sub elements like “Street,” “City,” and “State.”
And, the XML instance of the Shipping Address data type is shown
in
Listing 4.15.
The structure also can contain both simple and complex data type values
that can reference each other (see Listing 4.16). The structure uses the “href” attribute
to reference the value of the matching element.
SOAP Message Exchange Model
In a SOAP message, SOAP nodes are usually represented with an endpoint URI as
the next destination in the message. In a SOAP message, a SOAP node can be any
of the following:
SOAP sender. The one who generates and sends the message.
SOAP receiver. The one who ultimately receives and processes
the message with a SOAP response, message, or fault.
SOAP intermediary. The one who can play the role of a SOAP
sender or SOAP receiver. In a SOAP message exchange model, there
can be zero or more SOAP intermediaries between the SOAP sender
and receiver to provide a distributed processing mechanism for SOAP
messages.
In a SOAP message exchange model, the SOAP message passes from
the initiator to the final destination by passing through zero to many
intermediaries.
It is important to note that SOAP does not define the actual SOAP
senders, intermediaries, and receivers of the SOAP message along
its message path or its order of destination.
SOAP Messaging
It defines a document-driven communication where SOAP nodes send and
receive XML-based documents using synchronous and asynchronous
messaging
SOAP RPC
Similarly, the SOAP response message will return the results as return
values with zero or more out parameters.
In both SOAP RPC requests and responses, the method calls are serialized
into XML-based data types defined by the SOAP encoding rules.
using the SOAP headers provides a way to define and add features enabling the
implementation of application-specific security in a form of XML-based
metadata.
The <xenc:EncryptedData> element in the header entry provides the reference to the
<xenc:EncryptedData> element and the symmetric key is defined in the
<xenc:EncryptedKey> element.
On the SOAP receiver node, the receiver decrypts each encrypted element by
associating a Decryption-Info URI, which indicates <xenc:DecryptionInfo>
for providing information on how to decrypt it.
The SOAP sender node that originates the message applies an XML-based
digital signature to the SOAP body and the receiver node validates the
signature
The Signature Method defines the algorithm for converting the canonicalzed
Signed Info as a Signature Value.
SOAP Authorization
Using XML-based authorization in SOAP messages enables the authorization of
the SOAP messages using certificates from the originating SOAP sender nodes
SOAP authorization applies an XML-based digital certificate from an
independent authorization authority to the SOAP message from the sender.
And, it can be encrypted using the receiver node or an actor’s public key. On
the SOAP receiving node, the actor uses its private key to retrieve the
certificate.
Building SOAP Web Services
This enables the creation of Web services over existing applications without
modifying the underlying applications
SOAP server applications also can act as SOAP intermediaries, which allows the
extensibility of the application to enable the processing and forwarding of
messages through a series of SOAP nodes or a final destination
In case of acting SOAP intermediaries, the SOAP server application typically works as
a SOAP client application to the final destination of the message
Developing SOAP Web Services Using Java
SOAP does not mandate a single programming model nor does it define
programming language-specific bindings for its implementation.
It is up to the provider to choose a language and to define the
implementation
of its language-specific bindings.
In this context, to use Java as a language for developing SOAP
applications requires its Java implementation for SOAP specific bindings.
As of today, there are many SOAP application vendors that have made Java-based
SOAP implementations for developing Web applications to Web services.
In general, the use of Java for developing SOAP applications enables
scalable and portable applications to be built that also can interoperate with
heterogeneous applications residing on different platforms by resolving the
platform-specific incompatibilities and other issues
A long list of open source communities, Web services platform providers, and J2EE
vendors also have released their SOAP implementations adopting Java platform
and Java based APIs
Because our focus is creating Web services using Axis, we require Axis installation
using a Java servlet engine.
For illustration, we will be using the Apache Tomcat 4.0.3 servlet engine available
for download from
http://jakarta.apache.org/tomcat/index.html.
Now, let’s take a look at the steps involved in installing Axis within
an Apache Tomcat server environment:
4.To deploy the Axis libraries as a servlet in the Tomcat container, create a context in
the Tomcat server configuration by editing TOMCAT_HOME/conf/server.conf with the
following lines:
<Context path=”/axis” docBase=”axis” debug=”0”
reloadable=”true” crossContext=”true”>
</Context>
2.The specification does not address issues like object activation and
object lifecycle management
3.The specification discusses HTTP as the primary transport
protocol but does not discuss the usage of other transport protocols.
Note that the limitations of SOAP have been currently well addressed
by the ebXML framework as part of the ebXML messaging service,
which complements SOAP and other Web services standards.
UNIT 3
Web Services Description Language (WSDL)
WSDL represents information about the interface and semantics of how to invoke
or call a Web service
A WSDL definition contains four important pieces of information about
the Web service:
Interface information describing all the publicly available functions
Data type information for the incoming (request) and outgoing
(response) messages to these functions
Binding information about the protocol to be used for invoking
the specified Web service
Address information for locating the specified Web service
WSDL is capable of describing Web services that are implemented using any
language and deployed on any platform. Thus, WSDL contributes toward
enabling interoperability in the Web service architecture.
This element defines the abstract definition of the operations supported by a Web
service, by combining various request and response messages defined by <message>
elements.
Each operation refers to an input message and an output message.
<binding>
This element specifies a concrete protocol and data format used for
representing the operations and messages defined by a particular <port Type>,
on the wire
<port>
This element aggregates a set of related <port> elements, each which uniquely specify
the binding information of the Web service. A <service> consisting of multiple <port>
elements essentially represents the capability of the service to be invoked over
multiple bindings
WSDL Bindings
In WSDL, the term binding refers to the process of associating protocol or data
format information with an abstract entity such as <message>, <operation>, or
<portType>.
WSDL Binding Extensions
Binding describes the concrete correlation to these abstract notions. Binding determines
how the messages are actually sent, for instance, within a single communication (for
example, an HTTP request/response) or as two independent communications (for
example, two HTTP requests).
Thus, binding for a specific operation type must be defined in order to successfully
carry out that type of operation.
Note that although the WSDL structure supports the bindings for these four operations,
the WSDL specification defines bindings for only one-way and request-response
operations.
Hence, in order to use WSDL to describe services that support solicit-response and/or
notification types of operations, the communication protocol of the Web service
must define the WSDL binding extensions, thus enabling the use of these operations
WSDL Tools
WSDL tools typically provide functionality in terms of the following:
WSDL generation.
Generating WSDL from an existing service component—for example, a J2EE
component or a Java Bean component or from scratch.
WSDL compilation
Atypical WSDL compiler would generate the necessary data structures and a
skeleton for the implementation of the service. The generated
implementation skeleton contains all the methods (operations) that are
described in the given WSDL definition.
WSDL proxy generation.
This functionality can read a WSDL and produce a specific language binding
(for example, Java or Perl)consisting of all the code required to bind the
Web service and to invoke the Web service functions at runtime. This
functionality is typically used at the client end.
Many WSDL tools provide support for these three functionalities.
Table 5.1 lists some of the famous ones in the Java Web Services space.
Limitations of WSDL