We talked about the old fashion and how about the new one? For my understanding, the key difference from the earlier version is, Axis2 provides very convenient container to look after the web service application. With Axis2, you would no longer need to call the AdminClient to deploy the service like what we did earlier.
Axis2 container is deployed on the application server no difference with the other web applications. The place you need to deploy your web service application is webapps/axis2/WEB-INF/services. There are two options for your deployment, either deploy as Plain Old Java Objects (POJO) or deploy as .aar file.
For POJO deployment, you should have your application structure complaint to the following.
There are three mandatory components
- lib – to hold all necessary libraries file for you application
- META-INF – it should hold a services.xml file, which tells Axis how to deploy the service
- Compiled (POJO) class files – where you hold your service logic
Here is an example of the services.xml file. Make sure the “name” attribute of service tag should be identical to the directory name of your application and the value for ServiceClass should be the implementation class of the service.
<service name="xxxx" scope="application">
Alternatively, you could deploy your application as a .aar file. The preceding plugin (axistools-maven-plugin) has helped us to get the compiled code from WSDL file. We can carry on our work with it and build the .aar file with another plugin
In the configuration part, I ask plugin to copy the services.xml (the same as the preceding one) into .aar file’s META-INF directory.
All you need to do next is copy the .arr file into the Axis2 service directory. Simple?