In this post i want to describe:
- how to generate a WSDL file from the JAX-WS annotated class using jaxws-maven-plugin (jaxws:wsgen)
- how to generate the Java client class files from the generated WSDL file using jaxws-maven-plugin (jaxws:wsimport)
Firstly you have to generate your WSDL file from JAX-WS annotated class (class that annotated with @WebService), for this purpose you can use jaxws-maven-plugin, this maven plugin has a goal with name "wsgen", you can configure your maven project so that generate WSDL file during build process:
Note that you have to repeat "execution" tag for each jax-ws class with different id. The WSDL file will generate in "target/generated-sources/wsdl" directory (you can see other configuration tag from this).
Then you have to use generated WSDL file to generate Java client class files . for this purpose you can use "wsimport" goal :
Now you can use codes which are generated into "sourceDestDir" to call web service method in your client application.
have a nice time.