Generating code from WSDL using the XML catalog

Is there any tool for generating Java code from WSDL using XML Directories? The problem is that I have wsdl files that import XML schemas that also import other schemas, and the schemas are not available at the schemaLocation address. This is why code generation fails. If the tool could use the XML catalog, this problem would be solved without changing each scheme in each WSDL and scheme.

I tried the Eclipse and Netbeans plugins, but both failed. In Eclipse and Netbeans, I configured the location of alternate schemas using an XML directory, and so they can validate WSDL files without errors. However, when they generate code from wsdl, they fail.

+3
source share
4 answers

I just discovered that the JBoss wsconsume tool is able to use XML directories to resolve the entity, and it works great.

http://community.jboss.org/wiki/JBossWS-wsconsume

+1
source

Just for the record: I created a small example of a Github project that uses an XML schema. this can be of any help: https://github.com/fmarot/xml-mapping-tutorial Be sure to check your wiki to get an overview: https://github.com/fmarot/xml-mapping-tutorial/wiki

+1
source

WSDL XML, , WSDL, .

, , JBoss, .

0

Meanwhile, I found another solution that best suits my needs. There is a maven plugin called jaxws-maven-plugin that can also handle XMLCatalogs when creating sources from wsdl.

https://jax-ws-commons.dev.java.net/jaxws-maven-plugin/

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
    <execution>
        <id>id1</id>
        <phase>generate-sources</phase>
        <goals>
            <goal>wsimport</goal>
        </goals>
        <configuration>
            <verbose>true</verbose>
            <keep>true</keep>
            <catalog>${basedir}/src/main/resources/catalog.xml</catalog>
            <packageName>org.example</packageName>
            <wsdlDirectory>
                ${basedir}/src/main/resources/contracts/wsdl/ExampleService/1
            </wsdlDirectory>
            <wsdlFiles>
                <wsdlFile>ExampleService_1_0.wsdl</wsdlFile>
            </wsdlFiles>
            <xadditionalHeaders>false</xadditionalHeaders>
        </configuration>
    </execution>
</executions>
<configuration>
</configuration>
<dependencies>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-tools</artifactId>
        <version>2.1.7</version>
    </dependency>
</dependencies>

0
source

Source: https://habr.com/ru/post/1730557/


All Articles