Weblog

Calling Axis task wsdl2java from an ANT build file

Recently, I had to call webservices from a java GUI application. To do this I used Apache AXIS to generate STUB and Skeleton classes from the webservices WSDL files. In this posting, I will explain how I have invoked the WSDL2Java from a build.xml file to automate the generation of the stub and skeleton classes for the webservices. Note that you have to download Apache Axis distribution and install it locally.

First you have to set a path variable in your build file to locate the AXIS libraries. Note that all the AXIS libraries are in this path!

  <path id="axis.classpath">
    <fileset dir="${lib.to-compile-local.dir}/axis">
      <include name="**/*.jar" />
    </fileset>
  </path>

Secondly, you define the resource file with task definitions:

 <taskdef resource="axis-tasks.properties"
     classpathref="axis.classpath" />

Now you can use the specific task to generate the java stub and skeleton classes from the appropriate WSDL files. Note that you can just point to an URL and that the output dir can be used twice and is not overwritten each time..

 <target name="make-axis">
  <axis-wsdl2java
      output="${axis.generated.dir}"
      verbose="true"
      url="${url1}" >
  </axis-wsdl2java>
  <axis-wsdl2java
      output="${axis.generated.dir}"
      verbose="true"
      url="${url2}" >
  </axis-wsdl2java>
 </target>

A colleque will explain soon on this blog how to use the generated stub and skeleton classes to call the webservices from Java.

Share and Enjoy:
  • del.icio.us
  • Google Bookmarks
  • DZone
  • LinkedIn
  • SphereIt
  • StumbleUpon
  • Technorati

4 Responses to “Calling Axis task wsdl2java from an ANT build file”

  1. IT-eye Weblog » Invoking a PL/SQL webservice using WSIF Says:

    [...] sses first have to be generated. Tom has described how to do this using Axis in an earlier blog Note that in this example only the generated PortTy [...]

  2. JMK Says:

    Hi!

    I wonder… You write that

    “A colleque will explain soon on this blog how to use the generated stub and skeleton classes to call the webservices from Java.”

    Will this be anytime soon? Guess what I am about to do right now? ;)

    Cheers,

    /JMK

  3. v v s sunil kumar Says:

    Issue:

    We had two WSDD files.

    1.deploy.wsdd (generated while WSDL is converted to java).
    2.Server-config.wsdd.

    We have to copy replace some (two) tags in server-config.wsdd with two tags in deploy.wsdd.

    The names of the two tags are same in both files.

    We have to write the script for this task in build.xml.
    Can any one help me in writing this script?

  4. GAURI SANKAR GHOSH Says:

    Nice one!!
    Thanks a lot!

    Can neone temme how do I check out directly from CVS…any .sh scripts??

Leave a Reply

Technology