This plugin can generate WSDL, server side code used to start web service and client side code from
a java class.
Here is a simple example:
<plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-java2ws-plugin</artifactId> <version>2.1.3</version> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>2.1.3</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-simple</artifactId> <version>2.1.3</version> </dependency> </dependencies> <executions> <execution> <id>process-classes</id> <phase>process-classes</phase> <configuration> <className>org.apache.hello_world.Greeter</className> <genWsdl>true</genWsdl> <verbose>true</verbose> </configuration> <goals> <goal>java2ws</goal> </goals> </execution> </executions> </plugin>
Here are the options you can use:
<configuration> <className>...</className> <classpath>...</classpath> <outputFile>...</outputFile> <genWsdl>..</genWsdl> <genServer>..</genServer> <genClient>..</genClient> <genWrapperbean>..</genWrapperbean> <frontend>...</frontend> <databinding>...</databinding> <serviceName>...</serviceName> <soap12>...</soap12> <targetNameSpace>...</targetNameSpace> <verbose>...</verbose> <quiet>...</quiet> </configuration>
The outputFile value by default will be:
{project.build.directory}/generated/wsdl/{className}.wsdl
Refer to this link http://cwiki.apache.org/CXF20DOC/java-to-ws.html for other options detailed usage.