Saturday, June 14, 2008

Java Soap Client using axis library

This post is an example Java Soap client call using the apache axis library.

First you need to download axis from This library provides tools to convert a wsdl into a Java stub class that you can then use.

Once you've extracted the axis directory run the following command on the wsdl that you want to consume.

java -cp axis-1_4/lib/wsdl4j-1.5.1.jar:axis-1_4/lib/saaj.jar:axis-1_4/lib/jaxrpc.jar:axis-1_4/lib/axis.jar:axis-1_4/lib/commons-logging-1.0.4.jar:axis-1_4/lib/commons-discovery-0.2.jar:. org.apache.axis.wsdl.WSDL2Java

If you have your classpath set up you probably don't need as much but for simplicity I included all the jars in the axis distribution.

Now you can use the stubs that were generated

import com.daehosting.webservices.ISBN.*;

class client {

public static void main(String argv[]) throws Exception {

ISBNServiceSoapType service = new ISBNServiceLocator().getISBNServiceSoap();




For further reading I recommend the following book Java Web Services.

No comments: