Friday, June 5, 2015

Create a simple web service with Axis2

Introduction of Axis2

Apache Axis2 is the next generation of the apache web services stack. Apache axis2 was born with experiences of past two generations of apache service stack,Apache SOAP and Axis1.x. Axis2 comes with lots of new features,enhancements and new industry specifications including AXIOM, Asynchronous Web services, MTOM, MEP support and archive based deployment architecture.
Axis2 is mainly a soap processing engine. its main task is to deliver incoming soap messages to target endpoints.


One of the main goal of introducing axis2 is to provide better xml processing mechanism. Axis used DOM as xml processing mechanism. but there are some of drawbacks,because it needs to keep complete object hierarchy in memory. Therefore Axis2 introduce Axiom(Axis2 object model).All messages in axis2 are represented as object models. 

  • This sample demonstrate the complete process for the deploy web services through a axis2 server.

    1.Run the Axis2 soap engine

    first need to download Axis2 Standard binary distribution here .Distribution includes variety of *.jar 's and scripts that ease development.

    <Axis2_Home>/bin/ directory includes (axis2server.bat) file that enable start the axis2 server engine.

    ~/Documents/axis2-1.6.2/bin$ sh

    1.Axis2 Server started


    2.Create Order Processing web service

    This is my sample order processing web service. There are three methods

     i    addOrder- allow users to add orders- take argument, return values
  • ii. cancelOrder-allow users to cancel the order- only  argument, no return     values.

    iii. getOrders-allow users to retrieve back only all placed orders-take argument,return value.

    + create web service by using Eclips IDE. First of all create java project as SampleOrderProcessingService.

    + then add

     as external JAR s to the project. These JARs can be found in <AXIS2_HOME>/lib folder.

    2.jar files

    +add the following service class codes to your own service class

  •     This is my class

    complete Sample OrderprocessingService class can be download in following

    + need to write service.xml file for deploy above service through Axis2 Server by specifing service operations.
    First create META-INF folder at the root level.Add the services.xml to in it.

    Now our sampleOrderProcessing Service has already deployed in the server.

    SampleOrderProcessing File can download from here:here
    That's all my blog post regarding creating axis2 web service.I expect to post  client program to invoke the above web service in my next post.





1 comment:

  1. Create a simple web service by using Axis2.This will help you to create your own one.