IV Axis2 client implementation

Client code generation

To generate the java code for the axis client from the definition.wsdl file :

  1. Create a new Dynamic Web Project called Axis2TutorialClient
  2. Right-click on the definition.wsdl file in the Eclipse Project Explorer view
  3. Choose : Web Services > Generate Client

Choose Install service in the top left spinner, and select :

  • the target Server (Tomcat)
  • the target Web service runtime (Axis2)
  • the Service project (Axis2TutorialClient)

Axis2 client code generation

Click the Next button and select the custom mapping option. Select a target package for types in the namespace http://axis.tutorial/AxisTutorial :

Axis2 custom mapping definition

Click the Finish button. The client sources are generated under the axis.tutorial package of the Axis2TutorialClient Project :

AxisTutorialClient project

Client implementation

To call the service, you just have to get a new Axis2TutorialStub instance and call it's getById function :

Download the example index.jsp page to test your brand new web service. Copy it into the /WebContent folder of the AxisTutorialClient project. Start Tomcat and open the URL http://localhost:8080/AxisTutorialClient/.

Axis2 test page form

Axis2 test page result