Tuesday, December 7, 2010

Embedding Axis2 into an Existing Application

Many of you may came up with implementing Web Services for existing application, here I have done it using Apache Axis 2, So here what you need to do,

You should edit your web.xml file found in WEB-INF directory, and there you have to configure Axis specific information, (You must configure AxisServlet there, so when the application deploying server will identify that Axis2 is plugged in to this application)


        Apache-Axis Servlet

Now add servlet mapping,

This will tell the Axis Servlet that all your Web Services will include in a directory called services, So the service URL's must have services text within their URL's

If you do not wish to add your web services in a directory called services, you can change this to something else,

i.e :

And you need to tell axis2.xml that where are your services,


Axis2 assumes that all your service implementations are in a directory called services, in WEB-INF folder. so if you are not changing that, you don't have to modify axis2.xml file.

Thats all you have to do, Remember to copy all the JAR files in Axis2 distribution to your WEB-INF/lib directory :)

So when the application deploying in the server, it will initialize the AxisServlet and loads the web service implementations from default locations,

Default Service Location


Default Module Location


Default Axis2 XML Location


Directory structure.


  1. I have a web service and I have deployed it in axis2 inside tomcat. Can you tell me how can I deploy this web service in mydomains.com/WEB-INF/services/mywebservice.aar
    I can deploy it in tomcat and use the URL of the server such as myservice.com:8080/axis2/myservice?wsdl to access it but I want a different public URL for others to public... Hope you understand what I am trying to say.. Thanks

  2. Hi,

    Sorry for the late reply.
    You have a public domain or IP?

  3. Hi ,

    Can u pls post the axis2.xml for reference.