1) Introduction
The article titled Programming Web Services using Apache Axis shows how Axis Framework has simplified the creation of Web Services. It will start with the definition of Web Services and its related terminologies like SOAP and WSDL. Following that the ease with which Web Services are published are explained. The later section explores about the various tools available in the Axis distribution like the Tcp Monitor, Soap Monitor, Mapping between Java and WSDL. Finally the article ends up by giving a Sample Web Service Application deployed in Axis.
2) Web Services
2.1) Introduction
Web Services enables two applications running in two different machines to communicate. Data exchange between two heterogenous applications can be possible with Web Services. Technically, Web Services uses XML to exchange data between applications. Web Service is not a single technology, but instead it is a mix of the following technologies.
Let us look into these two terminologies briefly in the following sections.
2.2) SOAP
SOAP, which stands for Simple Object Access Protocol, defines the Request and the Response message format in a Web Service Application. Simply put, it is nothing but a XML structure adhering to a well defined Schema. A Web Service client sends Request to a Web Service in the form of SOAP message and gets the response back in SOAP message only. Let us look into the structure of the SOAP message in the following section.
A SOAP message consists of a SOAP Envelope which forms the outer most layer and it merely serves as a container for the SOAP Header and SOAP Body Elements. The SOAP Header will carry information that doesn't constitute to the original part of the message. For example, a SOAP Header may carry some Application Specific Information language such the Locale information. This SOAP Header is optional only. They SOAP Body consist of the original data that needs to be processed by the Web Service Application. Consider the following xml snippet which illustrates the SOAP message.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
2.3) WSDL
Web Services Description Language (WSDL) is again a XML Document that describes the definition of Web Services so that they can be accessible by the Client. Technically, WSDL Document contains the name of the Web Services, the arguments it is going to accept, the URL through which it can be accessed. At a higher level, WSDL contains two definition set, one is the Abstract Definition set which contains very generic information about the various supported data-types along with the information pertaining to messages, port-types and operations. The second is the information very specific to the type of protocol that can be used to access the services, the supported protocol list, the URL information etc. Following is the structure of the WSDL Document.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://ttdev.com/ss"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SimpleService"
targetNamespace="http://ttdev.com/ss">
<wsdl:types>
<!-- Definition of types here -->
</wsdl:types>
<wsdl:message name="requestName">
<wsdl:part name="requestName"/>
</wsdl:message>
<wsdl:message name="responseName">
<wsdl:part name="responseName"/>
</wsdl:message>
<wsdl:portType name="serviceName">
<wsdl:operation name="operationName">
<wsdl:input message="requestName" />
<wsdl:output message="responseName" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="bindingName">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="operationName">
<soap:operation soapAction="someUrl" />
<wsdl:input>
<soap:body parts="requestName" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body parts="responseName" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="serviceName">
<wsdl:port binding="bindingName" name="bindingName">
<soap:address
location="ClientAccessibleUrl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
One of the good things about the Axis Engine is that Developers doesn't really need to know the low-level issues like the SOAP message, WSDL because they are given higher level of abstraction.
|