Easy Way to Deploy a POJO based Web Service in Apache Axis2
By Deepal Jayasingha
- 1 Jun, 2007
The different methods through which a POJO based Web service can be deployed in Axis2:
- Deploying as a service archive file
- Creating a service using AxisService.createService(POJO class)
- Using a POJO Deployer
In this document we will discuss how to deploy a POJO application in Axis2 is by using a POJO Deployer as it is the most convenient way. A POJO deployer is yet another custom deployer in Axis2, that provides a very easy way to deploy and un-deploy a POJO application in Axis2. You can just drop the .class files or the .jar file, without requiring a services.xml or service.aar file.
By using a POJO deployer, you can deploy either a JSR 181 annotated class or a simple Java class, or even a .jar file with multiple annotated classes.
To use this feature, you must first enable the POJO deployer in Axis2.xml. Enabling the POJO deployer is just a matter of adding the following XML segment into axis2.xml
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
Here the "directory" attribute refers to the location at which you are going to deploy the POJO application inside the repository. You can change the directory name to a name you like. One thing to note here is, once you add the above tag into axis2.xml, you have the ability to deploy POJO as a .class file.
If you want to deploy the annotated POJO as a .jar file, then you need to add one more XML tag as follows;
<deployer extension=".jar" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
Apache Axis2/Java, v 1.2