...
Code Block | ||||
---|---|---|---|---|
| ||||
<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>
|
...
This will load the wsdl /org/apache/pizza/PizzaService-1.0.0.wsdl into your local maven repository and generate java code from it.
Example 6: Using xjc extensions
CXF offers some extensions for the code generation which can be activated by adding them as dependencies.
artifact id | description |
---|---|
cxf-xjc-boolean | Adds getters for booleans |
cxf-xjc-bug671 | Workaroung for JAXB bug 671 |
cxf-xjc-dv | Default value support |
cxf-xjc-ts | Adds toString to objects |
cxf-xjc-wsdlextension | WsdlExtension support |
Code Block | ||||
---|---|---|---|---|
| ||||
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
</plugin>
|