III Axis server implementation

Server skeleton generation

To generate the java skeleton for the axis server from the definition.wsdl file (Top down Java Web Service) :

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

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

  • the target Server (Tomcat)
  • the target Web service runtime (Axis)
  • the Service project (AxisTutorialServer)

Top down Axis Web Service

Click the Next button and select the custom mapping option :

Axis custom mapping option

Select a target package for types in the namespace http://axis.tutorial/AxisTutorial :

Axis custom mapping definition

Click the Finish button. The server skeleton sources are generated under the axis.tutorial package of the AxisTutorialServer Project :

AxisTutorialServer project

Service implementation

You just need to implement the getById method in the AxisTutorialSOAPImpl.java class to provide the desired service :

AxisTutorialSOAPImpl.java

Download the full ListEmployeesSoapBindingImpl.java file

Set up the web application

Before you start the service provider, you must set up Axis to start and handle your web service on the application startup. The web.xml file under WebContent > WEB-INF tells Tomcat to map the Axis servlet to the /services URL. It means that every HTTP request made to an URL starting with /services will be handled by the Axis servlet.

web.xml

The Axis servlet use the server-config.wsdd file under WebContent > WEB-INF to deploy services. Create this file and use the following server-config.wsdd template.

server-config.wsdd

Download the server-config.wsdd template

If you want your service to be deployed on startup like AdminService and Version, just paste the service node of your generated deploy.wsdd file into the server-config.wsdd file. The deploy.wsdd file is generated under WebContent/WEB-INF/axis/tutorial/.

server-config.wsdd

Download the final server-config.wsdd file

Our service provider web application is now finished. The implementation is quite simple and return a CD from the catalog. It's now time to build the service requester.