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>${cxf.version}</version>
	<dependencies>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxws</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-simple</artifactId>
			<version>${cxf.version}</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 and their defaults:

<configuration>
   <className>...</className>
   <classpath>...</classpath>
   <outputFile>...</outputFile>
   <genWsdl>true</genWsdl>
   <genServer>false</genServer>
   <genClient>false</genClient>
   <genWrapperbean>false</genWrapperbean>
   <frontend>jaxws</frontend>
   <databinding>jaxb</databinding>
   <serviceName>...</serviceName>
   <soap12>false</soap12>
   <targetNameSpace>...</targetNameSpace>
   <verbose>false</verbose>
   <quiet>false</quiet>
   <attachWsdl>true</attachWsdl>
   <address>...</address>
</configuration>

For detailed descriptions of the configuration elements see Java to WS page.

The outputFile value by default will be:

${project.build.directory}/generated/wsdl/${className}.wsdl
  • No labels

0 Comments