Monday, September 30, 2013

How to generate JAX-WS client and integrate with client application

 my previous post explained about  how to deploy the web service in the tomcat web server.   So, our web service is up and running now. it is time to create/generate the web service client and integrate it with our application.

  we can generate the Web Service client from the WSDL file. wsimport utility will help to generate java based web service client from the given WSDL.So in our scenario, we can generate the web service client with following linux command.

wsimport  -keep  -verbose  -d <directory_to_create_web_service_client>  <wsdl_url>

-verborse (print the status of the operation being  executed to the terminal)
 -d  (path to the directory where the web service client should be created)

 wsimport  -keep  -verbose -d /home/chathuranga/java/jax-ws/client  http://localhost:8080/calculator-service/calcServiceUrl?wsdl 


now we have successfully completed the process of generating the web service client. it can be integrated with your application now.

The source code for the complete example can be found at following github url.


Hope this will helpful for you!

Cheers
Chathuranga Tennakoon
chathuranga.t@gmail.com






No comments:

Post a Comment