An easy way to deploy pojo based Axis2 web services
Ever wonder deploying axis2 web services without archiving them in aars? There is an easy way to deploy axis2 web services directly inside any servlet container. Lets see how this simple deployment can be done..
If you haven't configured axis2 yet, get latest version from here
Simply copy axis2.war file in to the webapps directory of your favorite servlet container. Assuming apache tomcat 6 as the servlet container, axis2.war should be copied to ..\apache-tomcat-6.0.10\webapps. Start tomcat. axi2.war will be deployed inside tomcat.
Now you have to tell Axis2 to expose files in the given formats as web services. It can be done by adding the following custom element in to axis2.xml which can be found at ..\apache-tomcat-6.0.10\webapps\axis2\WEB-INF\conf\.
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer">
This simply says, the files with the extension .class which are placed at pojo directory will be exposed as web services.
You need to create a new directory, pojo inside ..\apache-tomcat-6.0.10\webapps\axis2\WEB-INF.
Now write your service implementation class.
public class myservice{
public String echo(String s){
return s;
}
}
Compile and save it under the above pojo directory.
Restart tomcat and access axis2 administration page. (http://localhost:8080/axis2)
You will be able to see the deployed service.
If you haven't configured axis2 yet, get latest version from here
Simply copy axis2.war file in to the webapps directory of your favorite servlet container. Assuming apache tomcat 6 as the servlet container, axis2.war should be copied to ..\apache-tomcat-6.0.10\webapps. Start tomcat. axi2.war will be deployed inside tomcat.
Now you have to tell Axis2 to expose files in the given formats as web services. It can be done by adding the following custom element in to axis2.xml which can be found at ..\apache-tomcat-6.0.10\webapps\axis2\WEB-INF\conf\.
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer">
This simply says, the files with the extension .class which are placed at pojo directory will be exposed as web services.
You need to create a new directory, pojo inside ..\apache-tomcat-6.0.10\webapps\axis2\WEB-INF.
Now write your service implementation class.
public class myservice{
public String echo(String s){
return s;
}
}
Compile and save it under the above pojo directory.
Restart tomcat and access axis2 administration page. (http://localhost:8080/axis2)
You will be able to see the deployed service.
Comments