algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)



Web Services

Web Service: a software system designed to support interoperable machine-to-machine interaction over a network.
the interface (contract) of communication is called WSDL.

Web Services Architecture

Service Registry:An registry which maintains the list of service providers.
Service Provider:The one which provides the service.
Service Requestor: The one which requests the service which is the client.
the service requestor or the client sends a SOAP request in an HTTP/SNMP/UDP packet and at the service provider
side the SOAP request is extracted from the packet and interpreted.
Top – Down / Bottom Up Approaches
In top-down approach wsdl is written first and then the java code is generated and implemented.
in bottom-up approach java code is written first and then the wsdl is generated for the same.
Web services with eclipse
eclipse plugin to install: axis2-eclipse-codegen-plugin
downlaod and extract to plugins folder of eclipse.
WSDL- web services description Language.
Parts of a WSDL
  1. Service : is a collection of network endpoints, or ports.
  2. Binding : the communication protocol used along with the data format specification.
  3. Port Type :collection of abstract operations.
  4. Messages : the data being exchanged.
  5. Types       : has the data types used by the web service.
  6. Operation : description of the operation supported by the service.
  7. Port : endpoint which is a combination of a binding port and a network address
wsdl structure looks like this.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:message name="messageName">
<wsdl:portType name="portName">
<wsdl:binding name="soapBinding" type="impl:portTypeName">
<wsdlsoap:binding style="document" transport=""/>
<wsdl:service name="serviceName">    
<wsdl:port binding="soapBinding" name="HelloWorld">

WSDL supports four types of operations { one-way , request-response , solicit-response , notification }
<soap:binding transport indicates the protocol used for sending the soap request
http,snmp,smtp,ftp etc.
Hello world web services using Eclipse and axis2 plug in.
  1. create a new project with name HelloWebService
  2. write a simple Java Class
    public class HelloImpl {
    // says hello
    public String sayHello() {
    return "Hello world";
    // adds two numbers
    public int addNumbers(int a, int b) {
    return a + b;

  3.  Right click on the above class file, select –> Web Services –> Create Web Service
  4. and select test Service from the panel, which will create the webservice as well as test the service.
  5. the server runtime can be used to select the application/web server and click next.
6. Select the methods of the java class to be exposed as webservice operations in this case , sayHello and addNumbers operations
7. Start the server clicking the start button in the next window and then click next.
8. click next and Finish, which will open the Web services Explorer


Search 24 Bytes