jaxws:wsimport两个声明在ObjectFactory类中引起冲突

时间:2018-09-22 11:31:06

标签: java maven jaxb jax-ws wsimport

我遇到了一些与此https://stackoverflow.com/questions/13422253/xjc-two-declarations-cause-a-collision-in-the-objectfactory-class类似的问题,并且似乎绑定对wsdl模式完全没有影响。无论我如何设置schemaLocationnodexpath,都没有效果。最重要的是,错误消息不会引入太多信息。

以下是maven插件配置:

<plugin>
    <groupId>org.jvnet.jax-ws-commons</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <verbose>true</verbose>
        <xdebug>true</xdebug>
        <detail>true</detail>
        <bindingFiles>
            <bindingFile>${project.basedir}/src/main/resources/bindings.xjb</bindingFile>
        </bindingFiles>
        <wsdlUrls>
            <wsdlUrl>https://cdx.dealerbuilt.com/0.99a/Api.svc?wsdl</wsdlUrl>
        </wsdlUrls>
        <args>
            <arg>-B-XautoNameResolution</arg>
        </args>
        <vmArgs>
            <vmArg>-Djavax.xml.accessExternalDTD=all</vmArg>
            <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
        </vmArgs>
        <keep/>
        <sourceDestDir>${project.basedir}/src/main/java/</sourceDestDir>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
</plugin>

这是绑定定义:

<jaxb:bindings>
    <jaxb:schemaBindings>
        <jaxb:nameXmlTransform>
            <jaxb:typeName prefix="Type_"/>
            <jaxb:elementName suffix="Element_"/>
            <jaxb:anonymousTypeName suffix="Anon_"/>
            <jaxb:modelGroupName suffix="Group_"/>
        </jaxb:nameXmlTransform>
    </jaxb:schemaBindings>
</jaxb:bindings>

<jaxws:bindings node="//xs:element[@name=asd]">
    <jaxb:schemaBindings>
        <jaxb:nameXmlTransform>
            <jaxb:elementName suffix="Elem"/>
        </jaxb:nameXmlTransform>
    </jaxb:schemaBindings>
</jaxws:bindings>

<jaxb:bindings schemaLocation="https://cdx.dealerbuilt.com/0.99a/Api.svc?xsd=xsd14">
    <jaxws:bindings node="//xs:element[@name=asd]">
        <jaxb:schemaBindings>
            <jaxb:nameXmlTransform>
                <jaxb:elementName suffix="Elem"/>
            </jaxb:nameXmlTransform>
        </jaxb:schemaBindings>
    </jaxws:bindings>
</jaxb:bindings>

结果是我最终得到一堆:

com.sun.istack.SAXParseException2; systemId: https://cdx.dealerbuilt.com/0.99a/Api.svc?xsd=xsd14; lineNumber: 1; columnNumber: 913; Two declarations cause a collision in the ObjectFactory class.
com.sun.istack.SAXParseException2; systemId: https://cdx.dealerbuilt.com/0.99a/Api.svc?xsd=xsd8; lineNumber: 1; columnNumber: 14330; Two declarations cause a collision in the ObjectFactory class.
com.sun.istack.SAXParseException2; systemId: https://cdx.dealerbuilt.com/0.99a/Api.svc?xsd=xsd4; lineNumber: 1; columnNumber: 11847; Two declarations cause a collision in the ObjectFactory class.

0 个答案:

没有答案