使用CXF进行XML验证,具有特定的MinOccurs和MaxOccurs

时间:2011-12-08 11:37:16

标签: jaxb cxf

我使用cxf 2.1并让cxf通过设置

来验证soap请求
<jaxws:properties>
    <entry key="schema-validation-enabled" value="true" />
</jaxws:properties>

我有xml架构,如:

<xsd:element name="roolInfo">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="a" type="aType"/>
      <xsd:element name="b" type="bType"/>
      <xsd:element name="v" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

当客户端发送没有'element v'的soap消息时受minOccurs =“0”maxOccurs =“unbounded”的限制,我不明白为什么服务器端的cxf抛出异常

org.apache.cxf.interceptor.Fault: Unmarshalling Error: cvc-complex-type.2.4.b: The content of element 'ns2:rootInfo' is not complete. One of '{v}' is expected.
..

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'ns2:rootInfo' is not complete. One of '{v}' is expected.
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3158)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3105)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3007)

有什么建议吗?

谢谢

0 个答案:

没有答案