Reputation: 9286
I'm trying to use CXF to consume a SOAP web service. The issue I'm having is that JAXB throws up when trying to consume the WSDL. The part it doesn't like is:
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
<xs:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
</xs:sequence>
It gives the error:
Property "Any" is already defined. Use
<jaxb:property>
to resolve this conflict.
From reading other questions such as this one, it is possible to define an external binding file to resolve the error. The issue is I'm not sure how to do this within the cxf-codegen-plugin
. Can anyone point me at how to do it?
Here is the relevant part of my pom.xml
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.2</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/resources/DataGeneratorInbox.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 2
Views: 6290
Reputation: 137104
The issue is I'm not sure how to do this within the
cxf-codegen-plugin
. Can anyone point me at how to do it?
You can add binding files in the cxf-codegen-plugin
with the <bindingFiles>
attribute, like this:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.2</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/resources/DataGeneratorInbox.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
<bindingFiles>
<bindingFile><!-- path to your file --></bindingFile>
</bindingFiles>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 3