简体   繁体   English

wsdl 中的 Xsd 选择产生错误

[英]Xsd choice in wsdl producing error

I'm currently working on a wsdl/soap project using Java/apache cxf.我目前正在使用 Java/apache cxf 开发一个 wsdl/soap 项目。 In the wsdl file, the xsd part includes a xsd external file.在 wsdl 文件中,xsd 部分包含一个 xsd 外部文件。
When I build my file (using wsdl2java) everything runs fine.当我构建我的文件(使用 wsdl2java)时,一切都运行良好。 However when I try to open the web page and to use the javascript generated by cxf, I have the following error:但是,当我尝试打开 web 页面并使用 cxf 生成的 javascript 时,出现以下错误:

May 24, 2011 11:34:32 AM org.apache.cxf.common.xmlschema.XmlSchemaUtils unsupportedConstruct
SEVERE: GROUP_CHILD
May 24, 2011 11:34:32 AM org.apache.cxf.transport.http_jetty.JettyHTTPDestination doService
WARNING: writeResponse failed: 
org.apache.cxf.common.xmlschema.UnsupportedConstruct: GROUP_CHILD
...

I tried to catch the error and I found something in the following block:我试图捕捉错误,并在以下块中发现了一些东西:

<xsd:complexType name="Scenario">
    <xsd:sequence>
    <xsd:element name="description" type="tns:Description" minOccurs="0"/>
        <xsd:choice>
            <xsd:element name="coordinates_center_position" type="tns:GeoCoord3D"/>
            <xsd:element name="coordinates_center_position_link" type="tns:FileLink"/>
        </xsd:choice>
        <xsd:choice minOccurs="0">
            <xsd:element name="environment_parameters" type="tns:EnvironmentParameters"/>
            <xsd:element name="environment_parameters_link" type="tns:FileLink"/>
        </xsd:choice>
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="entity_object" type="tns:EntityObject"/>
            <xsd:element name="entity_object_link" type="tns:FileLink"/>
        </xsd:choice>
    </xsd:sequence>
</xsd:complexType>

The last choice is producing the error, but the error disappear (and everything works fine) if I'm commenting one of the 2 element (the commented element can be either one).最后一个选择是产生错误,但如果我正在评论 2 个元素之一(被评论的元素可以是任何一个),错误就会消失(并且一切正常)。

I am missing something on the cxf or xsd behavior?我在 cxf 或 xsd 行为上遗漏了什么? Or is this a bug?或者这是一个错误?

PS: I'm relatively new to all this stuff so if you need something else to elude this or if I'm not clear enough, just tell me. PS:我对所有这些东西都比较陌生,所以如果您需要其他东西来逃避这一点,或者如果我不够清楚,请告诉我。

Thanks.谢谢。

I would try to replace the repeating xsd:choice using the pattern below.我会尝试使用下面的模式替换重复的 xsd:choice。 Technically, they are equivalent - yet, it may get you around a limitation - as it may be related to the use of the xsd:choice.从技术上讲,它们是等效的 - 但是,它可能会让你绕过一个限制 - 因为它可能与 xsd:choice 的使用有关。

This:这个:

<xsd:choice minOccurs="0" maxOccurs="unbounded">
    <xsd:element name="a"/>
    <xsd:element name="b"/>
</xsd:choice>

can be replaced by:可以替换为:

<xsd:sequence maxOccurs="unbounded">
    <xsd:element name="a" minOccurs="0"/>
    <xsd:element name="b" minOccurs="0"/>
</xsd:sequence>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM