to resolve this conflict-6ren"> to resolve this conflict-我正在尝试使用 CXF 来使用 SOAP Web 服务。我遇到的问题是 JAXB 在尝试使用 WSDL 时抛出。它不喜欢的部分是: 它给出了错误: Property "Any"-6ren">
gpt4 book ai didi

java - 属性 "Any"已定义。使用 to resolve this conflict

转载 作者:行者123 更新时间:2023-11-30 03:13:42 32 4
gpt4 key购买 nike

我正在尝试使用 CXF 来使用 SOAP Web 服务。我遇到的问题是 JAXB 在尝试使用 WSDL 时抛出。它不喜欢的部分是:

<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
<xs:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
</xs:sequence>

它给出了错误:

Property "Any" is already defined. Use <jaxb:property> to resolve this conflict.

通过阅读其他问题,例如 this一,可以定义一个外部绑定(bind)文件来解决错误。问题是我不知道如何在 cxf-codegen-plugin 内执行此操作。谁能告诉我该怎么做?

这是我的 pom.xml 的相关部分

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/DataGeneratorInbox.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

最佳答案

The issue is I'm not sure how to do this within the cxf-codegen-plugin. Can anyone point me at how to do it?

您可以在cxf-codegen-plugin中添加绑定(bind)文件与 <bindingFiles> 属性,如下所示:

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/DataGeneratorInbox.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
<bindingFiles>
<bindingFile><!-- path to your file --></bindingFile>
</bindingFiles>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

关于java - 属性 "Any"已定义。使用 <jaxb :property> to resolve this conflict,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33123195/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com