Developers
Local Navigation
Exercise
Apache Axis provides a WSDL2Java command-line tool that you can use to generate server stubs and deployment descriptors for a given WSDL file. In this lab, you place the example implementation of the calculator service in the server stub files. The deployment descriptors provide the information required by Axis to deploy and remove the service.
Prerequisites
Objectives
- Discover how to generate server stubs.
- See how Apache Axis provides a WSDL2Java command-line tool that you can use to generate server stubs and deployment descriptors for a given WSDL file.
Setup Tasks
Make sure the calc.wsdl file created in the previous lab is in a current folder. Or, download the WSDL file.
Tasks
- Verify that the Apache Axis libraries are in your class path.
- To generate the server stubs, run WSDL2Java with the required arguments.
% java org.apache.axis.wsdl.WSDL2Java -o . -s -p calculator.ws calc.wsdl
| Argument | Description |
|---|---|
| -o | base output directory |
| -s | server-side generation is on |
| -p calculator.ws | package in which to place the code |
| calc.wsdl | name of the WSDL file |
Check Your Work
View the following files generated by the wsdl2java command (ZIP).
| File name | Description |
|---|---|
| Deploy.wsdd | passed to Apache Axis to implement the web service |
| Undeploy.wsdd | passed to Apache Axis to remove the web service |
| CalculatorSoapBindingImpl.java | implementation code of the web service Note: You must edit this file to implement the server code. See "Implement the server code" on page 186 for more information. |
| Calculator.java | remote interface to the calculator |
| CalculatorService.java | service interface of the web service |
| CalculatorServiceLocator.java | helper for retrieving a handle to the web service |
| CalculatorSoapBindingStub.java | client stub code that encapsulates the client access |
Additional Labs
Go to the next exercise in "Building a Calculator Web Service Using Apache Tomcat/Axis", Implement the Server Code.