WSDL2Java – generating java code for your WSDL


you need to create a build.xml file

<!DOCTYPE project>

<project name=”AxisProject” default=”usage” basedir=”.”>

<property name=”project-name” value=”AxisProject”/>
<property file=”build.properties”/>

<property name=”build” value=”build”/>
<property name=”src” value=”src”/>
<property name=”build.classes”      value=”build/classes” />

<path id=”axis.classpath”>
<pathelement location=”build/classes” />
<fileset dir=”C:/axis2-1.4.1/lib”>
<include name=”**/*.jar” />
</fileset>
<pathelement location=”${build.classes}” />
</path>

<path id=”axis_client.classpath”>
<pathelement location=”build/classes” />
<fileset dir=”C:/axis2-1.4.1″>
<include name=”**/*.jar” />
</fileset>
<fileset dir=”lib”>
<include name=”*.jar” />
</fileset>
<pathelement location=”${build.classes}” />
</path>

<target name=”usage” description=”Build file usage info (default task)”>
<echo message=” ” />
<echo message=”${project-name} ” />
<echo message=”——————————————————-” />
<echo message=” ” />
<echo message=”Available Targets:” />
<echo message=” ” />
<echo message=” Compiling:” />
<echo message=”  compile           – Compiles the WSDL2Java source code” />
<echo message=” ” />
<echo message=” Compiling client:” />
<echo message=”  compile_client           – Compiles the client source code” />
<echo message=” ” />
<echo message=” Cleaning up:” />
<echo message=”  clean             – Delete class files” />
<echo message=” ” />
<echo message=” WSDL:” />
<echo message=”  wsdl2java               – Generate source from WSDL” />
<echo message=” ” />
<echo message=” AAR:” />
<echo message=”  aar               – Generate an .aar for deployment into WEB-INF/services” />
<echo message=” ” />
<echo message=” Executing:” />
<echo message=”  runLogin               – Execute the runLogin client” />
</target>

<target name=”prepare” >
<mkdir dir=”${build.classes}” />
</target>

<target name=”clean” >
<delete dir=”${build}” />
<delete dir=”${dist}” />
</target>

<target name=”compile”>
<echo message=”Compiling wsdl2 files”/>

<javac
srcdir=”output”
destdir=”${build.classes}”
deprecation=”true”
failonerror=”true” debug=”true”
>

<classpath refid=”axis.classpath”/>
</javac>

</target>

<target name=”wsdl2java” depends=”clean,prepare”>
<delete dir=”output” />
<java classname=”org.apache.axis2.wsdl.WSDL2Java” fork=”true”>
<classpath refid=”axis.classpath”/>
<arg value=”-d”/>
<arg value=”xmlbeans”/>
<arg value=”-uri”/>
<arg file=”wsdl/businessservices/examinermanagementservice/ExaminerManagementService.wsdl”/>
<arg value=”-ss”/>
<arg value=”-g”/>
<arg value=”-sd”/>
<arg value=”-o”/>
<arg file=”output”/>
<arg value=”-p”/>
<arg value=”org.example.types”/>
</java>

<!– Move the schema folder to classpath–>
<move todir=”${build.classes}”>
<fileset dir=”output/resources”>
<include name=”**/*schema*/**/*.class”/>
<include name=”**/*schema*/**/*.xsb”/>
</fileset>
</move>

</target>

<target name=”jar_wsdl” depends=”compile”>
<jar jarfile=”lib/axis2_example_wsdl.jar” >
<fileset dir=”${build.classes}” />
</jar>
</target>

<!– build an .aar file for axis2 web services –>
<target name=”aar” depends=”compile”>
<delete dir=”${build.classes}/META-INF” />
<mkdir dir=”${build.classes}/META-INF” />
<copy todir=”${build.classes}/META-INF” >
<fileset dir=”output/resources” >
<!– axis2 web services definitions file –>
<include name=”services.xml”/>
</fileset>
<fileset dir=”wsdl” >
<include name=”ExaminerManagementService.wsdl”/>
</fileset>
</copy>
<jar jarfile=”dist/ExaminerManagementService.aar” >
<fileset dir=”${build.classes}” />
</jar>
</target>

<target name=”compile_client”>
<echo message=”Compiling client files”/>

<javac
srcdir=”src”
destdir=”${build.classes}”
deprecation=”true”
failonerror=”true” debug=”true”
>

<classpath refid=”axis.classpath”/>
</javac>

</target>

<target name=”runLogin” depends=”prepare,compile_client” description=”run simple Login client”>
<java classname=”org.client.LoginClient” >
<classpath refid=”axis_client.classpath”/>
</java>
</target>

</project>

 

http://ws.apache.org/axis2/tools/1_0/CodegenToolReference.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s