UNIT -5
SOAP Tools
Web services are designed to share application logic with remote clients.
Web services achieve this by provides a set of communication and messaging standards.
Both services and clients must support these standards to effectively communicate with one another.
The SOAP messaging specification provides a standard protocol to package communication content for distribution over a network.
The client generates a SOAP message (an XML string) and sends it to a service for processing.
The service in turn generates results, packs it in a SOAP message and sends the response to the client.
Each service type maintains a WSDL which defines the operations and complex types exposed by the service.
Logically, the service is an object with methods (operations) used to interact with the service. The methods have both inputs and outputs defined as objects that store values (thus the term "value objects").
These objects are defined in the WSDL and can be primitive types, such as string or integer, or complex types explicitly designed to support service operations.
The Soap toolkits support the following:
SOAP client for developing a client-side application that consumes webservices
A SOAP Server for exposing the functionality of COM objects on the server
Complete support for the webservices Description Language (WSDL) 1.0 Specification
Universal Description, Discovery, and Integration (UDDI)
SOAP Specification version 1.1.
We build three components :
- A COM object that accesses the database for query.
- A Web service that exposes the functionality of the COM object.
- A client application that consumes the Web service.
Architecture :
Every SOAP service depends on three entities that form the architecture:
- Service Provider: All software systems or application which is a part or provides Web Service.
- Service Requester: All software systems or applications which is a part of requests Web Service from Service Provider.
- Service Registry: A registry or repository where all the information about Web Service is provided by the Service Provider.
The three entities interact with each other to carry out a successful Web Service Implementation.
This is done in three phases.
The first phase is the Publish() phase where a Service Provider feeds all the details about a Web Service in a Service Registry or Repository.
The second phase is Find() where a Service Request mainly the client application finds the details about Web Service from a repository (also has WSDL XML file).
The last phase is Binding() where the client application or the Service Requester synchronizes with the Service Provider for the final implementation of the Web Service.
Invoking a Web Service refers to the actions that a client application performs to use the Web Service. Client applications that invoke Web Services can be written using any technology: Java, Microsoft .NET, and so on.
Types of Client Applications
This section describes two different types of client applications:
- Stand-alone—A stand-alone client application, is a Java program that has the Main public class that you invoke with the java command. It runs completely separately from WebLogic Server.
- A J2EE component deployed to WebLogic Server—In this type of client application, the Web Service invoke is part of the code that implements an EJB, servlet, or another Web Service. This type of client application, therefore, runs inside a WebLogic Server container.
Invoking a Web Service from a Stand-alone Client:
Steps:
To create a Java stand-alone client application that invokes a Web Service:
- Open a command shell and set your environment.
2. Update your build.xml file to execute the clientgen Ant task to generate the needed client-side artifacts to invoke a Web Service.
3. Get information about the Web Service, such as the signature of its operations and the name of the ports.
4. Write the client application Java code that includes an invoke of the Web Service operation.
5. Compile and run your Java client application.
Exposing Web Services
A Web Service must be exposed in order to be available from other Web applications and to comply with the W3C specification. Exposing a Web Service means that a programmer creates the interface for it.
There are mainly two ways to expose a Web Service:
- "SOAP"
- "REST"
"SOAP" is a communication protocol defining the message format to be used for communication with Web Services. "SOAP" is based on "XML" and is a W3C standard.
"RESTful" is an architectural style that specifies constraints that, if applied to a Web Service, include desirable properties such as performance, scalability, and modifiability, which enable services to work best on the Web. The "REST" architecture works with a client/server architecture and is designed to use a stateless communication protocol, typically "HTTP".