Apache Axis2 code generator tool provides a very useful custom ANT task. All of the command line code generation options are available with the ANT task as well.
Lets see how a simple client side code generation is done using the ANT task.
Install Apache Axis2 -1.3 or higher
Install Apache ANT-1.7 or higher
Create a directory and start to create a build.xml inside that as given below. (eg:- C:\temp\build.xml)
<project name="CodegenExample" default="codegen" basedir=".">
<include name="**/*.jar" />
If you are familiar with ANT, you should be able to understand this simple build script easily. We use the path referenced as "axis2.classpath" to add Axis2 library jars which are placed at AXIS2_HOME/lib (In our example, C:\Axis2\Axis2-1.4\lib)
Axis2 codegen ant task is implemented by the org.apache.axis2.tool.ant.AntCodegenTask class. Therefore we refer to that inside a taskdef as given in "taskdef name="axis2-wsdl2java"
wsdlfilename attribute is equivalent to the -uri option in wsdl2 java command line tool and output is similar to -o option.
Replace the values of wsdlfilename according to your wsdl location.
Open a command prompt and go to the directory where you saved the above build.xml.
The generated stub classes will be saved in the specified out put directory.