Creating the web service
How to use the WSDL2WS tool on the command line
Deploying your web service
Deploying your web service Using AdminClient Tool
Coding the client
Running your sample
Before you follow this guide, make sure that you have followed the
Windows Installation guide
Currently axis supports two methods to create and deploy a Web Service.
Method 1) A top down approach where you start with a WSDL.
Method 2) A bottom up apporach where you start with a pre-written web
service.
Here we discuss the first apporach since the tool to support Method 2 (i.e
wcg.exe) is in a primitive and frozen state.
Here the document is written with the idea that the user uses Visual C++
(VC). But the user could use this guide with a different IDE of his choice.
Method 1
This method assums that the user has written the wsdl of the service which he
needs to deploy. In this method user will start with this wsdl and the tool
will generate the web service skeleton and other required files.
1) There is a folder called "simple" inside the samples/server folder in your axiscpp binary distribution. Inside this you can find the relevant wsdl for the calculator sample .Get the wsdl (eg:Calculator.wsdl)
2) Run the WSDL2WS tool (refer the section below 'How to use the WSDL2WS tool
on the command line') and generate the server side skeletons and wrappers.
These files will be in two new folder which are gentrated from the tool
called 'ServerOut' and 'ClientOut'.
3) Create a VC workspace.
4) Create a 'Win32 Static Library' project in this workspace.
5) Add the following files to this project, from the generated 'ServerOut'
folder. Calculator.cpp Calculator.h
6) Set the include path to the include directory of the binary distribution
(These include files are in AXIS_EXTRACT/include/).
7) Fill the empty methods of the generated skelitons.
8) Generate the lib (eg: MyCalculator.lib)
9) Now create a 'Win32 Dynamic-Link Library' project.
10) Add the following files to this project, from the generated 'ServerOut'
folder. CalculatorService.cpp CalculatorWrapper.cpp CalculatorWrapper.h
11) Set the include path to the include directory of the binary distribution.
12) Add the above created lib (Calculator.lib) as the input libraries of this
project.
13) Build and create the DLL. (Calculator.dll)
For using WSDL2Ws java tool on the command line you require jdk1.4 or
above.
To use WSDL2Ws java tool you should set the CLASSPATH Environment Variable to
point to the following jar files in AXIS_EXTRACT\lib\axisjava.
axis.jar
commons-discovery.jar
commons-logging.jar
jaxrpc.jar
saaj.jar
wsdl4j.jar
xml-apis.jar
The CLASSPATH Environment Variabe should have the absolute paths of the jars
(including the jar file name) given as a semicolon separated list.
Open a command window. Change directory to AXIS_EXTRACT\lib\axis. Create a folder of your choice and we will
call this folder as WSDL2WS_FOLDER.
Now copy the wsdl file (eg.Calculator.wsdl) which you use to the folder
WSDL2WS_FOLDER.
Copy the file wsdl2ws.jar from AXIS_EXTRACT\bin to WSDL2WS_FOLDER
Now change the directory to WSDL2WS_FOLDER and run the following command to generate the server side skeletons and
wrappers.
Java -classpath %classpath%;.\wsdl2ws.jar
org.apache.axis.wsdl.wsdl2ws.WSDL2Ws Calculator.wsdl -o./ServerOut -lc++
-sserver
If the file generation is successful the tool will display the files the it has
generated. The skeletons and wrappers will be generated in
[WSDL2WS_FOLDER]\ServerOut.
Run the following command to generate the client stubs.
Java -classpath %classpath%;.\wsdl2ws.jar
org.apache.axis.wsdl.wsdl2ws.WSDL2Ws Calculator.wsdl -o./ClientOut -lc++
-sclient
The generated client stubs will be in [WSDL2WS_FOLDER]\ClientOut
Axis cpp user can use the AdminClient tool to deploy a service or manually deploy. The first section
shows you how to deploy your Web Service manually, without using the
AdminClient tool.
Say the apache installation folder is APACHE_FOLDER.
(For the default installation this is "C:\Program Files\Apache Group\Apache"
for apache 1.3.X and "C:\Program Files\Apache Group\Apache2" for apache
2.X).
1) Copy the above Calculator.dll to the folder
APACHE_FOLDER/Axis/webservices.
2) Go and add the following in the server.wsdd at the service level. Make
sure you add these line at the correct place, i.e at service level.
(APACHE_FOLDER/Axis/conf/server.wsdd)
<service name="Calculator" provider="C:RPC" description="Calculator Web
Service">
<parameter name="className"
value="APACHE_FOLDER\Axis\webservices\Calculator.dll"/>
<parameter name="allowedMethods" value="add subtract "/>
</service>
Now you have deployed your web service