Consume jax-ws webservice

In this tutorial I will show how to create the Webservice client for jax-ws webservice. You can tell also how to consume the webservice.

A service has already been deployed into the server and we are given a wsdl file we can invoke the service from the remote area.


Eclipse 3.6
JDK 1.6

Before creating the client project you can have a look at the jax-ws webservice creating tutorial
We need to create a java project “jax-ws-client” and we already have a wsdl location – http://localhost:8888/jax-ws-ssl/hello?wsdl. You can also save the WSDL file and generate client from that.

Now we will generate the stubs or client from the http://localhost:8888/jax-ws-ssl/hello?wsdl

Now follow the steps carefully

1. Do “right-click” on the “jax-ws-client” project in Eclipse.

2. Go to “New -> Other”

3. In the wizard go to “Web Services -> Web Service Client”

4. Click “Next” and in the next wizard make sure the vertical bar is “Deploy Client”

5. Now enter the WSDL URL(http://localhost:8888/jax-ws-ssl/hello?wsdl) in the specified location or select the “Service definition:” using the “Browse” button

6. Click “OK”.

7. Click “OK” again

8. Now click “Finish”. The necessary classes will be generated.

9. Now create a main class which will be used for invoking the service. Please make sure the following things as highlighted in the screen-shot below.

10. The service invoking process in the main class is given below.


You will get the response as Hello Soumitra.

Thanks for your patience. Please do not forget to leave the comment.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.