I am trying to create a client with maven and jaxb from a wsdl file with two schemes inside and some elements with the same name from different schemes
When I try to compile, I get the following error:
Two declarations cause a collision in the ObjectFactory class.
WSDL schemes :
<wsdl:types> <schema targetNamespace="http://ws.services" xmlns="http://www.w3.org/2001/XMLSchema">...</schema> <schema targetNamespace="http://ws.models" xmlns="http://www.w3.org/2001/XMLSchema">...</schema> </wsdl:types>
I tried to rename the elements that cause the error, but then my spring client will get the correct SOAP message, but it does not populate the response object properly (all its attributes are zero) , I think the problem may be renaming the response classes, so I'm trying create different packages, keeping the original name of all classes.
To do this, I wrote the following bindings file, but I donβt know what I am doing wrong, because it does not work.
bindings.xml file :
<?xml version="1.0" encoding="UTF-8"?> <jaxb:bindings version="2.1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <jaxb:bindings schemaLocation="mywsdl.wsdl#types?schema1" node="/xs:schema[@targetNamespace='http://ws.services']"> <jaxb:schemaBindings> <jaxb:package name="package1" /> </jaxb:schemaBindings> </jaxb:bindings> <jaxb:bindings schemaLocation="mywsdl.wsdl#types?schema2" node="/xs:schema[@targetNamespace='http://ws.models']"> <jaxb:schemaBindings> <jaxb:package name="package2" /> </jaxb:schemaBindings> </jaxb:bindings> </jaxb:bindings>
My configuration in the maven file is the following, just in case it is useful:
<groupId>org.jvnet.jax-ws-commons</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.3</version> <executions> <execution> <goals> <goal>wsimport</goal> </goals> </execution> </executions> <configuration> <wsdlLocation>wsdl/mywsdl.wsdl</wsdlLocation> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> <wsdlFiles> <wsdlFile>mywsdl.wsdl</wsdlFile> </wsdlFiles> <bindingDirectory>src/main/resources/wsdl</bindingDirectory> <bindingFiles> <bindingFile>bindings.xml</bindingFile> </bindingFiles> <packageName>original.package</packageName> <sourceDestDir>${basedir}/src/main/java</sourceDestDir> </configuration>
When compiling with these binding files, the same error appears. So I think that maybe this is wrong.
Do you find any errors?
Thanks.
source share