Axis2 and Eclipse Plugin

on Wednesday, July 22, 2009

Axis2 is a marvelous tool for developing Web Services. It introduces good integration with Eclipse and a clean deployment model. Let me summarizes my study on this tool after a few days of hands-on with it.

What is my expectation to myself?

  • I am able to develop both top-down and bottom-up approach in a robust way.
  • I am able to develop both WSDL1.0, WSDL2.0
  • I am able to develop RESTful Web services.
  • I am able to develop Sync, Async, RESTful client.


My experiences in Axis2:

  • Eclipse is a wonderful IDE to work with but to fully utilize the Axis2 features. PLEASE DO NOT RELY ON Eclipse. It is quite disappointing.
  • Eclipse introduces rapid application development for web services and it transparents all the WSDL2JAVA, JAVA2WSDL command prompts for you. You can simply focus on your business logic if you are working on a simple web services project.
  • Customize the WSDL is very simple. Simply drop your own written WSDL into the META-INF folder and change the services.xml to force to use your own WSDL.

< name="useOriginalwsdl">true< /parameter >

  • You can write your own MessageReceiver and manipulate the way to parse a SOAP Message. It will be quite challenging and it is most likely needed if you are trying to deploy a very complicated web service.
  • Axis2 has some minor bug in handling the fault message. (Under the wsdl:binding, we should use wsdl:fault not wsdl:outfault)
  • For handling of fault, you can write your custom exception which extends from AxisFault and manipulate from there. However, I personally feel that we should always return to the SOAP client no matter is error or correct return.


My best practice in developing web services:
  • Hybrid of top-down and bottom up approach is more practical due to the fact that not many developers understand WSDL and coding WSDL is very tedious.
  • For bottom up approach, you will have more maintainability. This is because the code generated is not easy to understand and of course not easy to debug.



Methodology in developing web services using eclipse + Axis2 1.5
  1. Download axis2 1.5 and the war distribution.
  2. In eclipse, set the Axis2 runtime.
  3. Create a dynamic web application and link it to Tomcat 5 server.
  4. Create your service class.
  5. Create the web services using bottom-up approach in eclipse.
  6. Eclipse will automatically setup all the folder structure for you.
  7. Note that the jars is not the complete one. The complete one is in the war distribution.
  8. Replace the jars accordingly.
  9. Build the project and export as WAR to run.

0 comments: