+ Start a Discussion
chandraYeruvaRechandraYeruvaRe 

how to use WSDL 2 java

Hi I am using wsdl 2 java to get java source for the specified WSDL.Iam  using axis-2 1.4 and JDK 1.6 as my environment.

When i used to generate the java code from enterpriseWSDL for the example given in Force.com (QuickStat) I am only getting the 11 classes.Not able to get all the classes. Is i am missing something ? please help.

SuperfellSuperfell
The examples in the quickstart guide are for Axis 1.x, not Axis2
wsmithwsmith

Using Ant for Axis 2, this worked for me.  It is not difficult to extract the command from the target below.

 

    <target name="wsdl2java" depends="init">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <delete dir="${dir.tmp}"/>
        <mkdir dir="${dir.tmp}"/>
        <java classname="org.apache.axis2.wsdl.WSDL2Java"
              fork="true">
            <classpath refid="axis_client.classpath"/>
            <arg value="-l"/>
            <arg value="java"/>
            <arg value="-d"/>
            <arg value="xmlbeans"/>
            <arg value="-sn"/>
            <arg value="SforceService"/>
            <arg value="-o"/>
            <arg file="${dir.tmp}"/>
            <arg value="-uri"/>
            <arg file="${ENTERPRISE.WSDL}"/>
        </java>
        <copy todir="${dir.src}">
            <fileset dir="${dir.tmp}/src" includes="**/*.java"/>
        </copy>
        <!-- Move the schema folder to classpath -->
        <move todir="${dir.build}">
            <fileset dir="${dir.tmp}/resources">
                <include name="**/*.class"/>
                <include name="**/*.xsb"/>
            </fileset>
        </move>
        <delete dir="${dir.tmp}"/>

        <mkdir dir="${dir.tmp}"/>
        <java classname="org.apache.axis2.wsdl.WSDL2Java"
              fork="true">
            <classpath refid="axis_client.classpath"/>
            <arg value="-l"/>
            <arg value="java"/>
            <arg value="-d"/>
            <arg value="xmlbeans"/>
            <arg value="-sn"/>
            <arg value="MyService"/>
            <arg value="-o"/>
            <arg file="${dir.tmp}"/>
            <arg value="-uri"/>
            <arg file="${MYSERVICE.WSDL}"/>
        </java>
        <copy todir="${dir.src}">
            <fileset dir="${dir.tmp}/src" includes="**/*.java"/>
        </copy>
        <!-- Move the schema folder to classpath -->
        <move todir="${dir.build}">
            <fileset dir="${dir.tmp}/resources">
                <include name="**/*.class"/>
                <include name="**/*.xsb"/>
            </fileset>
        </move>
        <delete dir="${dir.tmp}"/>
    </target>