III Axis server implementation
Build a full web service with Axis
Server skeleton generation
To generate the java skeleton for the axis server from the definition.wsdl file (Top down Java Web Service) :
- Create a new Dynamic Web Project called AxisTutorialServer
- Right-click on the definition.wsdl file in the Eclipse Project Explorer view
- 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)
Click the Next button and select the custom mapping option :
Select a target package for types in the namespace http://axis.tutorial/AxisTutorial :
Click the Finish button. The server skeleton sources are generated under the axis.tutorial package of the AxisTutorialServer Project :
Service implementation
You just need to implement the getById method in the AxisTutorialSOAPImpl.java class to provide the desired service :
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.
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.
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/.
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.