Saturday, October 21, 2017

WebService TitBit - 5

Best Explanation about wsgen / wsimport



Courtsy >>

https://coderanch.com/t/625764/certification/difference-wsimport-wsgen-command

1. Can we say that wsgen and wsimport command generates same classes (same JAX-WS artifacts)? 
2. Can we say that wsgen and wsimport command is used to generate both server and client side code ? 
3. can wsgen command be used to generate a WSDL file ? 

Correct me if I am wrong. 
wsgen and wsimport generates JAX-WS artifacts from SBI and WSDL respectively. 
If those JAX-WS artifacts do not exist, when the service is published using Endpoint.publish or web service container (Tomcat), those artifacts are dynamically generated. 
If those artifacts exist (generated by wsgen), the Endpoint.publish does not generate those artifacts. 

1. Yes. wsgen and wsimport generate request and response wrapper bean classes and the JAXB classes (XXX.class and XXXResponse.class). 

However, wsgen generates the JAXB classes and put them in a jaxws folder. But wsimport does not put those classes in any folder instead in the current directory. 
2. The JAX-WS artifacts generated can be used by both server and client side. 
3. I think wsgen can be used to generate WSDL. Here is an example at http://www.mkyong.com/webservices/jax-ws/jax-ws-wsgen-tool-example/

No comments: