Codegen Binding xml not Working for nested WSDLs schema files

45 Views Asked by At

I do have to create Java Classes based on an SOAPService, of which i do have multiple WSDLs and Schemas. This will fail due to naming Issues. "Property already declared"

So i created a binding.xml

<jaxb:bindings
        jaxb:version="3.0"
        xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <jaxb:bindings
            schemaLocation="schema.xsd"
            node="/xs:schema/xs:complexType[@name='Objekt']/xs:sequence/xs:element[@name='Element']">
        <jaxb:property name="nameElement"/>
    </jaxb:bindings>

</jaxb:bindings>

This works as expected, if i have a WSDL (lets call it A) that imports this Schema. However in my case I have a WSDL file, that Imports another WSDL(lets call this B) that will import the schema.xsd.

I have tried to configure my CXF-Codegen-plugin to first generate the code for WSDL B and then generate the Code for WSDL A. This will result in a successful compilation for WSDL B, but once he tries to generate the Code for WSDL A, it fails. Because he doesn't notice that it has already been created, nor will he honor the binding.xml i provided.

Any Suggestions?

With this Setup the binding xml is basically ignored.

This is what my current Maven Setup looks like:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>4.0.2</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/wsdl/WSDL_B.wsdl</wsdl>
                                    <faultSerialVersionUID> 1 </faultSerialVersionUID>
                                    <wsdlLocation>classpath:wsdl/WSDL_A.wsdl</wsdlLocation>
                                    <bindingFiles>
                                        <bindingFile>${basedir}/src/main/resources/wsdl/binding.xml</bindingFile>
                                    </bindingFiles>
                                    <autoNameResolution>true</autoNameResolution>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
0

There are 0 best solutions below