I have a problem with the following sequence of a wsdl file
<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>
I tried to use jaxb binding customization :
<?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>
I'm trying to avoid jaxb - xjc from generating my fields as a List<JAXBElement<?>> validationErrorsAndAllowCaseWithExistingContractsAndInternalErrors
, is there anyway I could accomplish that?
I advise you to simplify the schema if possible. I would put the allowCaseWithNewContract
and allowCaseWithExistingContract
as attributes in the enclosing element. I guess then, the remaining choice would have the type ErrorType
.
我不允许发表评论,但是我相信这个问题在这里和这里都已经得到解决-基本上,您最好的选择是使用JAXB2简化插件,因为JAXB会阻止您执行想要的(反序列化)操作从XML到Java前后均保持一致(即,您需要保留顺序)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.