Sunday, September 11, 2011

Apache Axis2 Server: A Developer Guide To New Contributors

Env : OS - Ubuntu 10.04(Lucid Lynx)
        
Apache Axis2 is an open source web service / soap / wsdl engine. There are two implementations Axis2/java and Axis2/C. In here I'm talking about Axis2/java. There are three ways we can run Axis2 as,
  1. Axis2 binary distribution 
  2. Axis2 source distribution 
  3. Axis2 war(Web archive) distribution
But If you need to contribute to Axis2 development, you need to checkout the source code of Axis2 trunk and build it.Here I will talk on how to build Axis2 trunk, how to up the Axis2 server and deploy a simple service in Axis2. Then I am going to talk on how we can run Axis2 Server with our changes what we have done to source code.

Checkout Axis2 trunk


Axis2 project uses subversion as its version control system therefore we need to have subversion installed in our machine (If not you can install latest subversion by typing "sudo apt-get install subversion" in terminal).

Now you can checkout Axis2 trunk to your machine by typing "svn co <url_to_trunk>  <directory_name>".
eg: svn co http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/ axis2_trunk 
This will checkout Axis2 trunk to the axis2_trunk directory in our local machine.

Build Axis2 trunk

Axis2 uses Maven2 as its building tool, which means we need install maven2 in our machine to build axis2 source code. You can install maven2 by typing "sudo apt-get install maven2" .

Lets assume  you have checked out trunk to the directory called axis2_trunk, go to that directory and type "mvn install" it will build Axis2 by default. Then go to distribution module typing "cd modules/distribution/"  and again type "mvn install". It will build the distribution module as in default profile, it doesn't build this module. That's all and now you have build latest Axis2 trunk in your machine.


Up the Axis2 server and deploy a new service

Lets see how to up Axis2 server. After building process is finished it will create a target directory in distribution module. Now type cd target/axis2-1.7.0-SNAPSHOT/bin/  to navigate to bin directory. In bin directory you can see several .sh files, to run Axis2 server run "sh axis2server.sh" command in terminal.




















 It will up axis2server in default port 8080. Now go to you browser and type http://localhost:8080/axis2/services/ you can see axis2 services list and available operations.























You have built Axis2 trunk and up the Axis2 server in localhost. Now you can deploy your services in Axis2. It is a simple thing in Axis2 as it supports hot deployment which means you can deploy a service while Axis2 is up and running as it doesn't need to down the server and up it again after adding a new service. You just need to add <service_name>.aar file to repository/serivces/ directory in  axis2-1.7.0-SNAPSHOT .

However as developers we may need to deploy the same service again and again. Then you need to create new .aar file for each attempt and this is cumbersome. No need to worry , you can deploy a service by putting a directory which has content same as .aar file.

Run Axis2 with changes we have done to the source code

If you are a new contributor to Axis2 project then you need to run Axis2 server which new changes  you have done to the source code of Axis2. There are two ways you can accomplish this.
  • Go to the axis2_trunk directory and run "mvn clean install" then go to the distribution module and run "mvn clean install" commands in terminal. Now you have built Axis2 with modifications what you have done to the source. Go to the bin directory and run "sh axis2server.sh" to up the modified Axis2 server.
  •  If you have done changes to a few modules then you don't need to build all modules. Hence you just need to build those modules as we built distribution module in previous method. Lets say you have done modifications to kernel module, then you can build kernel module running "mvn clean install" inside the kernel module, copy axis2-kernel-<version>.SNAPSHOT.jar which was created in target directory of kernel module to the target/axis2-1.7.0-SNAPSHOT/lib/ directory in distribution module. Thats all and now you can up the Axis2 server by running sh axis2server.sh command inside the bin directory of distribution module.

0 comments:

Post a Comment

Sample Text

Website counter

Categories