I want to add java annotations the service endpoint implementation interface class for an Apache CXF web service client, generated from a WSDL.
This is the binding file I am using that should leverage the Annotate plugin for JAXB from http://confluence.highsource.org/display/J2B/Annotate+Plugin:
<jaxws:bindings wsdlLocation="OptenetServices.wsdl"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:annox="http://annox.dev.java.net"
jaxws:extensionBindingPrefixes="annox">
<jaxws:bindings node="wsdl:portType">
<annox:annotate>
<annox:annotate annox:class="org.jvnet.hk2.annotations.Contract" />
</annox:annotate>
</jaxws:bindings>
</jaxws:bindings>
There are no errors, but the annotation is just not created. I can confirm that the node is selected and the bindings are used because if I change the annox:annotate
with:
<jaxws:class name="Renamed">
<jaxws:javadoc>Blah blah</jaxws:javadoc>
</jaxws:class>
The interface is renamed and commented correctly.
It is unclear to me if annox can be used in this context and what is the relation between jaxb and jaxws bindings.
The code generation is handled by CFX, through Maven:
<build>
<plugins>
<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/service.wsdl</wsdl>
<extraargs>
<extraarg>-client</extraarg>
<extraarg>-p</extraarg>
<extraarg>com.example.pkg</extraarg>
<extraarg>-b</extraarg>
<extraarg>${basedir}/src/main/wsdl/bindings.xml</extraarg>
<extraarg>-xjc-Xannotate</extraarg>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.5</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Thanks.