3

Is there any tool for generating Java code from WSDL using XML Catalogs? The problem is that I have wsdl files that import XML schemas which also import other schemas and the schemas are not available at schemaLocation url. That is why code generation fails. If a tool was able to use XML Catalog this problem would be solved without modifying each schemaLocation in each WSDLs and schemas.

I have tried Eclipse and Netbeans plugins but both failed. In Eclipse and Netbeans I have configured alternative schema locations by using XML Catalog and so they can validate WSDL files without error. However, when they generate code from wsdl they fail.

Peter Miklos
  • 76
  • 1
  • 4

4 Answers4

1

Just for the record: i've set up a small exemple project on Github that uses an XML schema. it may be of any help: https://github.com/fmarot/xml-mapping-tutorial Be sure to check its wiki too in order to have an overview: https://github.com/fmarot/xml-mapping-tutorial/wiki

Francois Marot
  • 1,145
  • 11
  • 18
1

Just found that JBoss's wsconsume tool is able to consume XML Catalogs for entity resolution and it works fine.

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

Peter Miklos
  • 76
  • 1
  • 4
0

The WSDL has to be valid without the use of XML catalogs, or clients consuming that WSDL will not be able to consume it.

Of course, if you will never use any clients not running on the JBoss platform, then you'll be fine.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • I am not sure that what you said is true for the given situation. Often you want to build JAX-WS artefacts in offline mode (e.g. on build server) where Internet is not available. – dma_k Jan 27 '11 at 13:19
  • Yes, you are right. Sorry for my comment & confusion. I agree with you that online WebServices should have all XSDs in a tree available online, otherwise service consumption is problematic :) – dma_k Mar 20 '11 at 11:26
0

Meanwhile, I found an other solution that fits the best to my needs. There is a maven plugin called jaxws-maven-plugin that is also able to handle XMLCatalogs when generating 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>

Peter Miklos
  • 76
  • 1
  • 4
  • 2
    Could you publish your catalog.xml and a relevant part of WSDL, which you intend to trick? Thanks – dma_k Jan 27 '11 at 12:09