Hi,

In this post i want to describe:
  1. how to generate a WSDL file from the JAX-WS annotated class using jaxws-maven-plugin (jaxws:wsgen)
  2. 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:

    

.
.
.

org.jvnet.jax-ws-commons
jaxws-maven-plugin
2.2


SimpleWS

wsgen


com.saeed.NewWebService
true
UTF-8
true
true




TestWS

wsgen


com.saeed.TestWebService
true
UTF-8
true
true







org.glassfish.extras
glassfish-embedded-all
3.1.1



com.sun.xml.ws
jaxws-tools
2.2.5







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 :

    


org.codehaus.mojo
jaxws-maven-plugin
1.10



wsimport



../saeed-web/target/generated-sources/wsdl


NewWebService.wsdl

http://saeed-linux:8080/saeed-web/NewWebService?wsdl

wsimport-generate-NewWebService
generate-sources




javax.xml
webservices-api
1.4



${project.build.directory}/generated-sources/jaxws-wsimport
false
true
true






com.sun.xml.ws
webservices-rt
1.4
provided


junit
junit
3.8.1
test



Now you can use codes which are generated into "sourceDestDir" to call web service method in your client application.

have a nice time.