I have one set of Java classes generated from a WSDL that work fine; I'm adding another WSDL to the project for another webservice I'm using, but I get no @XmlRootElement annotations in the generated classes from the second WSDL, and don't understand why not.
Here's the plugin portion of the pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceType>wsdl</sourceType>
<sources>
<source>${resources.path}my-module/src/main/resources/wsdl/w1.wsdl</source>
<source>${resources.path}my-module/src/main/resources/wsdl/w2.wsdl</source>
</sources>
<extension>true</extension>
<xjbSources>
<xjbSource>src/main/resources/xjb/bindings.xjb</xjbSource>
</xjbSources>
</configuration>
</plugin>
And here's bindings.xjb:
<?xml version="1.0"?>
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings>
<!-- annotate tag here? -->
<jxb:globalBindings>
<xjc:simple/>
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
I read in this SO post about using an annotate
tag, so I inserted
<annox:annotate>
<annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" />
</annox:annotate>
at the indicated place in the bindings.xjb file, but of course I don't have a definition for the annox
prefix, so that doesn't work. The post doesn't indicate where that's defined.
I've also been through multiple answers in this SO post; unfortunately the various methods each leave out some steps. For instance, I'm willing to call marshall and unmarshall methods directly, but I need to know where to get the "JAXBContext" they speak of, and what the unmarshall call looks like, or where to look it up.
Is annox
the correct way to do this? Is there another correct way to do this?