wsimport – Generating Clients from a Service WSDL

The wsimport tool that comes bundled with the Java Development Kit allows developers to generate java classes and ultimately the client used to connect to the service from your own projects.

For example, if you wanted to leverage a business service provided by another team in the company that provides LegalEntity information and they provided you with the URL to the WSDL, you would start with the following:

E.g. Assuming the service is located at: http://some.devserver.com:8080/LegalEntityService?WSDL

1. Locate your JDK installation:
Note: If you don’t have this, please visit the Oracle Java websites and get the latest JDK)

e.g.
C:\Program Files\Java\jdk_\bin
C:\Program Files (x86)\Java\jdk_\bin

2. Open a command prompt and navigate to this location:

3. Run any one of the following examples:
Note: Read notes on the differences, avoid the mess of clogging up your bin directory in Java

Example 1: Creates all files in the same directory as wsimport

Example 2: Specifying a destination directory with the (-d) option

Example 3: Calling wsimport from another directory.
This example assumes you have navigated to a folder where you want the generated code to reside, and calling wsimport directly. This generates the files in the calling directory, so you won’t need a destination

For all other options, please refer to: http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html

4. Add the generated files to your project, or a separate JAR – Library Project

Leave a Reply

Your email address will not be published. Required fields are marked *