We help IT Professionals succeed at work.

Maven cxf wsdl to java archetype

akashsuresh
akashsuresh asked
on
I am trying a wsdl first approach to get java code generated in Eclipse.Which maven arechetype should I choose.
Comment
Watch Question

Commented:
Most archetypes can be used.

You can refer to Maven JAX WS Tutorial for more detail.

Just ensure you have the following plugin configuration in your pom.xml

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>jaxws-maven-plugin</artifactId>
				<version>1.12</version>
				<executions>
					<execution>
						<id>xmlvalidation</id>
						<goals>
							<goal>wsimport</goal>
						</goals>
						<configuration>
							<wsdlUrls>
								<wsdlUrl>"yourwsdlurl"?wsdl</wsdlUrl>
							</wsdlUrls>
							<packageName>your.client.package</packageName>
							<staleFile>${project.build.directory}/jaxws/stale/wsdl.xmlvalidation.done</staleFile>
						</configuration>
					</execution>
</executions>
</plugin>
</plugins>
</build>

Open in new window

Author

Commented:
I was looking for a cxf plugin actually.any way to do with that?
Commented:
Have a look at Maven CXF Plugin

e.g.

<plugin>
	<groupId>org.apache.cxf</groupId>
	<artifactId>cxf-codegen-plugin</artifactId>
	<version>${cxf.version}</version>
	<executions>
		<execution>
			<id>generate-sources</id>
			<phase>generate-sources</phase>
			<configuration>
				<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
				<wsdlOptions>
					<wsdlOption>
						<wsdl>${basedir}/src/main/wsdl/myService.wsdl</wsdl>
					</wsdlOption>
				</wsdlOptions>
			</configuration>
			<goals>
				<goal>wsdl2java</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Open in new window