2

Does anyone know of a complete example of generating a Java Client from a local WSDL file that uses custom jaxb bindings and generated using maven (also, preferably for windows)?

Is wsimport or wsdl2java recommended for this task?

Brandon
  • 6,832
  • 11
  • 38
  • 50

1 Answers1

3

The cxf-codegen-plugin should do the job.

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <executions>
        <execution>
        <id>generate-sources-composite</id>
        <phase>generate-sources</phase>
        <configuration>
            <sourceRoot>${basedir}/target/generated-sources/wsdl2java</sourceRoot>
            <defaultOptions>
            </defaultOptions>
            <wsdlOptions>
                <wsdlOption>
                    <wsdl>${basedir}/src/main/wsdl/service1.wsdl</wsdl>
                </wsdlOption>
                <wsdlOption>
                    <wsdl>${basedir}/src/main/wsdl/service2.wsdl</wsdl>
                </wsdlOption>
            </wsdlOptions>
        </configuration>
        <goals>
            <goal>wsdl2java</goal>
        </goals>
    </execution>
    </executions>
</plugin>

With this configuration, you just need to set the wsdl files and the java source generated folder (which should be in the target folder)

Julien Sere
  • 59
  • 1
  • 4