How to create web service client using Metro JAX-WS

In this tutorial i demo how to create web service client from wsdl using JAX-WS
Let’s start

1.  Prepare JAX-WS

Go to this and choose version you want to download that suite for your environment. I’m using tomcat 7 and JDK 7 so i using latest one now JAX-WS 2.2.8

Unzip to any folder in my for example: E:\JAXWS-RI

2. Setup environment

– create OS enviroment JAVA_HOME point to your java sdk

– create JAXWS_HOME point to your unzip folder

3. Generate code client

We will using wsimport tool in $JAXWS_HOME\bin to create web service client from wsdl resource. We can using wsdl file or http url point that wsdl resource.
Following command will generate class runtime and source code( –keep parameter tell tool keep source code for us)

E:\JAXWS-RI\bin>wsimport -keep IpnWebRetrieval.xml

After that you can copy code to any IDE tool to write your own project or create lib to import to your project.

Leave a Reply