First you need to download axis from ws.apache.org. 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 http://webservices.daehosting.com/services/isbnservice.wso?WSDL
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();
System.out.println(service.isValidISBN13("0000000000000"));
}
}
For further reading I recommend the following book Java Web Services.
No comments:
Post a Comment