Axis2 Part 1

Using the Axis2 framework we will create a simple web service, deploy it in a service of type 'Web' and finally create a web service client that calls it.

First thing to configure is the workbench path to the Axis2 framewotk, this is only done once

Configure Axis framework

In workbench window->preferences point to the xtellus360\axis2-1.6. folder 





Create Server Project

In workbench create a new project of type 'Dynamic Web Project'  we will call it MyAxisWS



Next screen we need to change to Dynamic web module version to 2.5 for the Axis2 generators to work. When using the CXF framework it will work with the latest versio




Next create a Tomcat 8 service and call it MyAxisWS add the project MyAxisWS to the new service. The service is created in the service view



The service will look like this in the service view. The service port is set to 8090 in our example



A demo wsdl file is copied into the newly created project. The demo.wsdl can be found in a forum group called Tool Code. In this example the service will be created from the wsdl.  



Next generate service template from the wsdl file. This will generate everything except the implementation of the service methods. Start generate the server by right-click the demo.wsdl and select web services->generate jave bean skeleton  

First screen where we change the runtime to Axis2


Next screen the package name is specified for the generated classes



The default values are used at the rest of the screens. 
The generated project now looks like this


 
The DemoServiceSkeleton.java class has a method getPrice where the service functionality is implemented. The generator generates an exeption in the method that we will replace in this example by returning 2 strings hello and world  




The MyAxisWS service could now be started in the service view by right-click and select debug, the service should start without problem at port 8090

The webservice can now be called. A Axis2 web app was also generated, start the browser and go to http://127.0.0.1:8090/MyAxisWS/



Click Services

 

And the DemoService link show the wsdl