Friday, February 15, 2008

Stub Creation with Apache Axis (WSDL2Java)

1. Download Axis from http://www.apache.org/dyn/closer.cgi/ws/axis/1_4 select appropriate mirror an can download binary or source version from that.

2. Unzip the folder to C:\tools\axis-1_4 dir.
Here we installed both of src and binary version and you will get following structure.

3. Now the time to generate Stub for WebService.
for that Axis provide one class named WSDL2Java.

Let's use this file. For that follow the step.

Set Class path for Axis.
- Create a axis.bat file with following data
-------Axis.bat Start ------------
set AXIS_HOME=c:\tools\axis-1_4
set AXIS_LIB=%AXIS_HOME%\lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;
%AXIS_LIB%\commons-discovery-0.2.jar;
%AXIS_LIB%\commons-logging-1.0.4.jar;
%AXIS_LIB%\jaxrpc.jar;
%AXIS_LIB%\saaj.jar;
%AXIS_LIB%\log4j-1.2.8.jar;
%AXIS_LIB%\wsdl4j-1.5.1.jar;
%AXIS_LIB%\endorsed\xml-apis-2.6.2.jar;
%AXIS_LIB%\endorsed\xercesImpl-2.6.2.jar;
%AXIS_LIB%\log4j-1.2.8.jar;
%AXIS_LIB%\jaxrpc.jar;
---------Axis.bat End------------

Make sure AXISCLASSPATH should be in single line.

4. Now run the following command from command prompt.
c:\>axis.bat

c:\> java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java (WSDL-file-URL)

5. Now at C: the Service Stub created successfully.

And ready to use.


1 comment:

Anonymous said...
This comment has been removed by the author.

Contributors