我对下面的wsdl文件序列有一个问题
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="allowCaseWithNewContract" type="xsd:boolean">
</xsd:element>
<xsd:choice minOccurs="0">
<xsd:element name="validationError" type="mnp:ErrorType"/>
<xsd:element name="internalError" type="mnp:ErrorType"/>
<xsd:element name="businessError" type="mnp:ErrorType"/>
<xsd:element name="externalError" type="mnp:ErrorType"/>
</xsd:choice>
</xsd:sequence>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="allowCaseWithExistingContract" type="xsd:boolean">
</xsd:element>
<xsd:choice minOccurs="0">
<xsd:element name="validationError" type="mnp:ErrorType"/>
<xsd:element name="internalError" type="mnp:ErrorType"/>
<xsd:element name="businessError" type="mnp:ErrorType"/>
<xsd:element name="externalError" type="mnp:ErrorType"/>
</xsd:choice>
</xsd:sequence>我尝试使用jaxb绑定定制:
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
<jxb:globalBindings>
<xjc:simple />
</jxb:globalBindings>
</jxb:bindings>我正在尝试避免jaxb - xjc将我的字段生成为List<JAXBElement<?>> validationErrorsAndAllowCaseWithExistingContractsAndInternalErrors,有什么方法可以实现吗?
发布于 2014-05-21 16:31:06
如果可能,我建议您简化模式。我会将allowCaseWithNewContract和allowCaseWithExistingContract作为属性放入封装的元素中。我猜,剩下的选择应该是ErrorType类型。
发布于 2018-07-19 19:19:35
我不被允许发表评论,但我相信这个问题已经被here和here解决了--基本上你最好的办法就是使用JAXB2 Simplify Plugin,因为JAXB会阻止你做你想做的事情,因为它希望(反)序列化在here和here之间保持一致(即你需要保持顺序)。
https://stackoverflow.com/questions/23754731
复制相似问题