Documentation Web Services
Documentation Web Services
25-10-2006
Ramarao G.v.
Introduction:
Even we can use CORBA as solution to establish communication between different objects. But our
millions of clients need to be maintained CORBA software in their machines.
Web Services using lightweight protocols to exchange the data over the net that help us to increase the
performance of an application.
XML:
Extensible Markup Language (XML) began as an extensible data format to address the limitations of
HTML (HyperText Markup Language), but has become a standard for communication between
applications. With XML, an application defines markup tags to represent the different elements of data in a
text file so that the data can be read and processed by any application that uses XML.
Using XML, it is possible for business persons to define policies and express them as XML documents.
These documents can have sections that are encrypted and the documents themselves can be digitally
signed, distributed, and then interpreted by the security mechanisms that configure the local software.
This allows various implementations to map from the XML description to a local platform-specific policy
enforcement mechanism without requiring changes to the infrastructure.
SOAP:
Simple Object Access Protocol (SOAP) is a simple, lightweight, and extendable XML-based mechanism
for exchanging structured data between network applications on top of widely used Internet standards such
as XML and HTTP (HyperText Transfer Protocol). SOAP consists of three parts: an envelope that defines a
framework for describing the contents of a message, a set of encoding rules for expressing instances of
application-defined data types, and a convention for representing remote procedure calls (RPC) and
responses. SOAP can be used in combination with a variety of network protocols such as HTTP, RMI/IIOP
(Remote Method Invocation/Internet Inter-ORB [Object Request Broker] Protocol), SMTP (Simple Mail
Transfer Protocol), FTP (File Transfer Protocol), or MQ (Message Queuing).
SOAP can potentially be used in combination with a variety of other protocols; however, the only
bindings we discuss here are SOAP in combination with HTTP and HTTP Extension Framework. The
usage of a particular protocol does not change the fundamentals of the security model but may change the
particular implementation.
The SOAP envelope is defined in XML and enables a large variety of meta-information to be added to
the message, such as transaction identifiers, message routing information, and message security. The
envelope consists of two parts: header and body. The header is a generic mechanism for adding features to
a SOAP message. All immediate child elements of the SOAP header element are called header entries.
The body is a container for application data intended for the ultimate recipient of the message. Thus,
SOAP can be considered as another layer, between the transport layer (e.g., HTTP) and the application
layer (e.g., business data), that is a convenient place for conveying message meta-information.
WSDL:
Web Services Description Language (WSDL) is essentially an XML IDL (interface definition language)
that provides a way to describe the function and interface of a service. It is a format for describing network
services as a set of endpoints operating on messages containing either document-oriented or procedure-
oriented information. The operations and messages are described abstractly, and then bound to a concrete
network protocol and message format to define an endpoint. Related concrete endpoints are combined into
abstract endpoints (services).
WSDL is extensible to allow description of endpoints and their messages regardless of what message
formats or network protocols are used to communicate; however, the only currently described bindings are
for SOAP 1.1, HTTP GET/POST, and MIME (Multipurpose Internet Mail Extensions).
The WSDL service information can be extracted from a UDDI (Universal Description, Discovery, and
Integration) business service entry, or may be obtained from other service repository sources.
To perform the three operations of publish, find and bind in an interoperable manner, there must be a Web
Services stack that embraces standards at each level. Figure shows a conceptual Web Services stack. The
upper layers build upon the capabilities provided by the lower layers. The vertical towers represent
requirements that must be addressed at every level of the stack. The text on the left represents standard
technologies that apply at that layer of the stack.
The STAX APIs and the Sun Java Streaming XML Parser implementation.
JAX-WS stands for Java API for XML Web Services. JAX-WS is a technology for building web
services and clients that communicate using XML.
In JAX-WS, a remote procedure call is represented by an XML-based protocol such as SOAP. The
SOAP specification defines the envelope structure, encoding rules, and conventions for representing remote
procedure calls and responses. These calls and responses are transmitted as SOAP messages (XML files)
over HTTP.
Although SOAP messages are complex, the JAX-WS API hides this complexity from the application
developer. On the server side, the developer specifies the remote procedures by defining methods in an
interface written in the Java programming language. The developer also codes one or more classes that
implement those methods. Client programs are also easy to code. A client creates a proxy (a local object
representing the service) and then simply invokes methods on the proxy. With JAX-WS, the developer does
not generate or parse SOAP messages. It is the JAX-WS runtime system that converts the API calls and
responses to and from SOAP messages.
With JAX-WS, clients and web services have a big advantage: the platform independence of the Java
programming language. In addition, JAX-WS is not restrictive: a JAX-WS client can access a web service
that is not running on the Java platform, and vice versa. This flexibility is possible because JAX-WS uses
technologies defined by the World Wide Web Consortium (W3C): HTTP, SOAP, and the Web Service
Description Language (WSDL). WSDL specifies an XML format for describing a service as a set of
endpoints operating on messages.
If you deployed to the Sun Java System Application Server, type two numbers in the tester page, as
shown below:
The sum of the two numbers is displayed:
Now that we have deployed our web service, we need to create a client to make use of the web service's
add method.
We can call the Web Service Operation through any no. of clients. The client may be of servlet or JSP or
any Java SE application.