Xsd choice in wsdl producing error
I'm currently working on a wsdl/soap project using Java/apache cxf. In the wsdl file, the xsd part includes a xsd external file.
When I build my file (using wsdl2java) everything runs fine. However when I try to open the web page and to use the javascript generated by cxf, I have the following error: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).
I am missing something on the cxf or xsd behavior? Or is this a bug?
P.S: 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.
Thanks.
I would try to replace the repeating xsd:choice using the pattern below. Technically, they are equivalent - yet, it may get you around a limitation - as it may be related to the use of the 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>
精彩评论