gpt4 book ai didi

xsd - 生成OTA CXF Web服务客户端时"Attribute group must have ref name set"

转载 作者:行者123 更新时间:2023-12-04 13:54:22 24 4
gpt4 key购买 nike

我正在使用 Apache CXF 运行时从已发布的 WSDL 生成 Web 服务客户端

此 WSDL 已通过 Open Travel Org (OTA) 提供的 XDS 生成,我确信它是正确的,但我同样放在这里。

我的问题是,当使用 Eclipse Kepler 的“创建 Web 服务”工具(使用 CXF 运行时 2.7.10 和 java 7u71)时,我通过 CXF 控制台收到此错误消息:属性组必须设置引用名称

    WSDLToJava Error: java.lang.RuntimeException: org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException: Attribute group must have ref name set

org.apache.cxf.tools.common.ToolException: java.lang.RuntimeException:
org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException:
Attribute group must have ref name set
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:420)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: java.lang.RuntimeException:
org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException:
Attribute group must have ref name set
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:642)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:443)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:714)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
... 4 more
Caused by:
org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException: Attribute group must have ref name set
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeAttributeGroupRef(XmlSchemaSerializer.java:562)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeAttributeGroup(XmlSchemaSerializer.java:523)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchemaChild(XmlSchemaSerializer.java:2406)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchemaElement(XmlSchemaSerializer.java:1659)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchema(XmlSchemaSerializer.java:132)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:640)
... 9 more

通过 Tomcat 控制台显示一个很长的 stachtraces 和“连接由对等重置:套接字写入错误”错误

要部署的 WSDL 如下:

    <?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="OTA_VehAvailRateService"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.opentravel.org/OTA/2003/05"
xmlns:ota="http://www.opentravel.org/OTA/2003/05">

<wsdl:types>
<xs:schema>
<xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="OTA_VehAvailRateRQ.xsd" />
</xs:schema>
<xs:schema>
<xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="OTA_VehAvailRateRS.xsd" />
</xs:schema>
</wsdl:types>

<wsdl:message name="OTA_VehAvailRateRequest">
<wsdl:part element="ota:OTA_VehAvailRateRQ" name="parameters"/>
</wsdl:message>
<wsdl:message name="OTA_VehAvailRateResponse">
<wsdl:part element="ota:OTA_VehAvailRateRS" name="parameters"/>
</wsdl:message>

<wsdl:portType name="OTA_VehAvailRatePortType">
<wsdl:operation name="OTA_VehAvailRateAction">
<wsdl:input message="ota:OTA_VehAvailRateRequest"/>
<wsdl:output message="ota:OTA_VehAvailRateResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="OTA_VehAvailRateSOAPBinding" type="ota:OTA_VehAvailRatePortType">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="OTA_VehAvailRateAction">
<soap12:operation soapAction="OTA_VehAvailRateSoapAction" style="document"/>

<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>

</wsdl:operation>
</wsdl:binding>


<wsdl:service name="OTA_VehAvailRateService">
<wsdl:port name="OTA_VehAvailRatePort" binding="ota:OTA_VehAvailRateSOAPBinding">
<soap12:address location="http://172.26.0.40:85/WebServiceAmadeus/services/OTA_VehAvailRatePort"/>
</wsdl:port>
</wsdl:service>

</wsdl:definitions>

更新:

我不认为原因是模式定义,因为:

  • 架构由 OTA(旅行经纪人网络服务国际标准)提供
  • 如果我使用同一工作区的本地地址来部署 Web 服务客户端,则效果很好。即:

代替使用:

    http://172.26.0.40:85/WebServiceAmadeus/services/OTA_VehAvailRatePort?wsdl

我使用:

    /WebServiceAmadeus/WebContent/wsdl/KarveOta.wsdl

其中 WebServiceAmadeus 是同一工作区的项目文件夹。

当然这不是解决方案,因为只能在语言环境主机中工作。

更新

我曾尝试使用其他 CXF 版本(2.4.2、3.0.2 等)遇到同样的问题。我尝试使用 SOAP 1.1 版遇到同样的问题。从 SOAP UI 5.0.0 开始,我可以部署获取请求,但响应显示 Unmarshalling Error: ?

最佳答案

用OTA发出同样的问题。我正在使用 spring ws,当我添加

时问题就解决了
<property name="inline" value="false"/>

org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection

关于xsd - 生成OTA CXF Web服务客户端时"Attribute group must have ref name set",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27053009/

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