English 中文(简体)
Code generation from WSDL using XML Catalog
原标题:

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.

问题回答

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

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

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.

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>





相关问题
Can t consume webservice from Java

I created the webservice stubs using axis2-1.5 s wsdl2java.bat. This created a src folder with the following structure in it: src/net/mycompany/www/services/SessionIntegrationStub.java The package ...

WSDL2Java tool error Apache CXF

We get the following error when we use WSDL2Java tool to generate stubs. The webservice is up and running. WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsd l ...

Code generation from WSDL using XML Catalog

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 ...

Apache Axis WSDL2Java error - Missing <soap:fault> element

We are integrating a third party SOAP web services in our application. The WSDL is used with SOAPUI tool, where sample requests and responses worked fine. When we try to integrate with apache Axis 1....

Axis wsdl2java not generating all interfaces in stub

I am trying to generate stub using wsdl2java.bat, my wsdl consists of two bindings. I see that wsdl2bat creates interface for operations in the first binding but does not generate anything for ...

热门标签