使用springboot模式将xml解组为java objectunexpected elementl文件

dtcbnfnu  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(177)

嗨,我在将xml文件解组为java对象时遇到了问题。
我习惯于使用wsdl文件为webservices生成java类,但在本例中,我是为springboot restfulapi而做的。它们只有我用来生成java类的模式文件。我的javasoapwebservice需要调出restapi,但是它无法将这个xml转换成java对象。我不理解它说packagepbtransactionpostrequest是意外的错误,但是它在预期的元素中列出了该对象。在模式中有什么我需要做的吗?
获取以下错误:jaxbexception将xml解组到java objectunexpected元素“packagepbtransactionpostrequest”中时发生。预期元素为“{http://chubbei/pbt/commercial_pbt_product_informationv1}商业PBT产品信息{http://chubbei/bound_transaction/commercial/package_pb_transaction_post_request_ccp50v1}packagepbtransactionpostrequest“.chubb.ei.btms.exception异常
这是请求模式,然后是发送进来的请求xml。我注意到的一件事是,模式将字段名的第一个字母全部大写,因此我尝试更改这些字母以匹配xml,但仍然不起作用。注意,构建这个java对象还有其他模式,只是我没有包含它们。问题可能在另一个模式中,因为我没有更新其中的案例,但我预料它会在其他模式中出错,而不是在请求对象中。
谢谢您

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v  IBM 2.2.10-06/29/2016 1:04:38 PMforeman- 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2021.03.10 at 11:16:44 AM EST 
//

package chubbei.bound_transaction.commercial.package_pb_transaction_post_request_ccp50v1;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import chubbei.pbt.package_policy_transactionv1.PackagePolicyTransaction;

/**
 * <p>Java class for PackagePBTransactionPostRequest complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="PackagePBTransactionPostRequest">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="PackagePolicyTransaction" type="{http://chubbei/pbt/package_policy_transactionv1}PackagePolicyTransaction" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="ValidationOnlyIndicator" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="SystemId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="UserId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="ProcessClassificationCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="ProcessClassificationName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="AdditionalOptionsText" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="ResumeActivityName" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="LineOfBusinessTypeCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PackagePBTransactionPostRequest", namespace = "http://chubbei/bound_transaction/commercial/package_pb_transaction_post_request_ccp50v1", propOrder = {
    "packagePolicyTransaction",
    "validationOnlyIndicator",  
    "systemId",
    "userId",
    "processClassificationCode",
    "processClassificationName",
    "additionalOptionsText",
    "resumeActivityName",
    "lineOfBusinessTypeCode"
})
@XmlRootElement(name="PackagePBTransactionPostRequest")
public class PackagePBTransactionPostRequest {

    @XmlElement(name = "packagePolicyTransaction")
    protected List<PackagePolicyTransaction> packagePolicyTransaction;
    @XmlElement(name = "validationOnlyIndicator")
    protected String validationOnlyIndicator;
    @XmlElement(name = "systemId")
    protected String systemId;
    @XmlElement(name = "userId")
    protected String userId;
    @XmlElement(name = "processClassificationCode")
    protected String processClassificationCode;
    @XmlElement(name = "processClassificationName")
    protected String processClassificationName;
    @XmlElement(name = "additionalOptionsText")
    protected List<String> additionalOptionsText;
    @XmlElement(name = "resumeActivityName", required = true)
    protected String resumeActivityName;
    @XmlElement(name = "lineOfBusinessTypeCode")
    protected String lineOfBusinessTypeCode;

    /**
     * Gets the value of the packagePolicyTransaction property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the packagePolicyTransaction property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getPackagePolicyTransaction().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link PackagePolicyTransaction }
     * 
     * 
     */
    public List<PackagePolicyTransaction> getPackagePolicyTransaction() {
        if (packagePolicyTransaction == null) {
            packagePolicyTransaction = new ArrayList<PackagePolicyTransaction>();
        }
        return this.packagePolicyTransaction;
    }

    /**
     * Gets the value of the validationOnlyIndicator property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getValidationOnlyIndicator() {
        return validationOnlyIndicator;
    }

    /**
     * Sets the value of the validationOnlyIndicator property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setValidationOnlyIndicator(String value) {
        this.validationOnlyIndicator = value;
    }

    /**
     * Gets the value of the systemId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getSystemId() {
        return systemId;
    }

    /**
     * Sets the value of the systemId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setSystemId(String value) {
        this.systemId = value;
    }

    /**
     * Gets the value of the userId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getUserId() {
        return userId;
    }

    /**
     * Sets the value of the userId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setUserId(String value) {
        this.userId = value;
    }

    /**
     * Gets the value of the processClassificationCode property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getProcessClassificationCode() {
        return processClassificationCode;
    }

    /**
     * Sets the value of the processClassificationCode property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setProcessClassificationCode(String value) {
        this.processClassificationCode = value;
    }

    /**
     * Gets the value of the processClassificationName property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getProcessClassificationName() {
        return processClassificationName;
    }

    /**
     * Sets the value of the processClassificationName property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setProcessClassificationName(String value) {
        this.processClassificationName = value;
    }

    /**
     * Gets the value of the additionalOptionsText property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the additionalOptionsText property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getAdditionalOptionsText().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link String }
     * 
     * 
     */
    public List<String> getAdditionalOptionsText() {
        if (additionalOptionsText == null) {
            additionalOptionsText = new ArrayList<String>();
        }
        return this.additionalOptionsText;
    }

    /**
     * Gets the value of the resumeActivityName property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getResumeActivityName() {
        return resumeActivityName;
    }

    /**
     * Sets the value of the resumeActivityName property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setResumeActivityName(String value) {
        this.resumeActivityName = value;
    }

    /**
     * Gets the value of the lineOfBusinessTypeCode property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getLineOfBusinessTypeCode() {
        return lineOfBusinessTypeCode;
    }

    /**
     * Sets the value of the lineOfBusinessTypeCode property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setLineOfBusinessTypeCode(String value) {
        this.lineOfBusinessTypeCode = value;
    }

}

请求xml

<PackagePBTransactionPostRequest>
    <packagePolicyTransaction>
        <transactionOptionsText></transactionOptionsText>
        <transactionOptionsText></transactionOptionsText>
        <commercialProcessBoundTransaction>
            <cpnumber></cpnumber>
            <commercialPBTTransactionInformation>
                <transactionExpirationDate></transactionExpirationDate>
                <bookingEntryTypeCode></bookingEntryTypeCode>
                <sourceSystemTransactionId></sourceSystemTransactionId>
                <policyNumber></policyNumber>
                <sourceSystemPolicyTermId></sourceSystemPolicyTermId>
                <sourceSystemTransactionTypeName></sourceSystemTransactionTypeName>
                <commercialPBTPolicyInformation>
                    <policySICCode></policySICCode>
                    <servicingAreaCustomerGroupAbbreviation></servicingAreaCustomerGroupAbbreviation>
                </commercialPBTPolicyInformation>
                <expiringPremiumAmount></expiringPremiumAmount>
                <transactionEffectiveDate></transactionEffectiveDate>
                <transactionGroupId></transactionGroupId>
                <totalTransactionPremiumAmount></totalTransactionPremiumAmount>
                <lostBusinessPremiumAmount>0</lostBusinessPremiumAmount>
                <inceptionDate></inceptionDate>
                <rateOfferedPercent>0</rateOfferedPercent>
                <expirationDate></expirationDate>
            </commercialPBTTransactionInformation>
            <writingCompanyCode></writingCompanyCode>
            <riskStateOrProvince>
                <postalStateAbbreviation></postalStateAbbreviation>
            </riskStateOrProvince>
            <producerNumber></producerNumber>
            <producerSubNumber></producerSubNumber>
        </commercialProcessBoundTransaction>
        <packageTransactionOrderNumber>1</packageTransactionOrderNumber>
        <lineOfBusinessTransaction>
            <transactionOptionsText></transactionOptionsText>
            <transactionOptionsText></transactionOptionsText>
            <commercialProcessBoundTransaction>
                <cpnumber></cpnumber>
                <commercialPBTTransactionInformation>
                    <policyTypeCode></policyTypeCode>
                    <transactionExpirationDate></transactionExpirationDate>
                    <sourceSystemTransactionId></sourceSystemTransactionId>
                    <policyNumber></policyNumber>
                    <sourceSystemPolicyTermId></sourceSystemPolicyTermId>
                    <sourceSystemTransactionTypeName></sourceSystemTransactionTypeName>
                    <commercialPBTPolicyInformation>
                        <policySICCode></policySICCode>
                        <servicingAreaCustomerGroupAbbreviation></servicingAreaCustomerGroupAbbreviation>
                    </commercialPBTPolicyInformation>
                    <expiringPremiumAmount>0</expiringPremiumAmount>
                    <transactionEffectiveDate></transactionEffectiveDate>
                    <policyTypeSubCode></policyTypeSubCode>
                    <transactionGroupId></transactionGroupId>
                    <totalTransactionPremiumAmount>50</totalTransactionPremiumAmount>
                    <lostBusinessPremiumAmount>0</lostBusinessPremiumAmount>
                    <inceptionDate></inceptionDate>
                    <rateOfferedPercent>0</rateOfferedPercent>
                    <expirationDate></expirationDate>
                </commercialPBTTransactionInformation>
                <writingCompanyCode></writingCompanyCode>
                <riskStateOrProvince>
                    <postalStateAbbreviation>AL</postalStateAbbreviation>
                </riskStateOrProvince>
                <producerNumber></producerNumber>
                <controlNumber></controlNumber>
                <producerSubNumber></producerSubNumber>
            </commercialProcessBoundTransaction>
            <lobtransactionOrderNumber>1</lobtransactionOrderNumber>
        </lineOfBusinessTransaction>
        <lineOfBusinessTransaction>
            <transactionOptionsText></transactionOptionsText>
            <transactionOptionsText></transactionOptionsText>
            <commercialProcessBoundTransaction>
                <cpnumber></cpnumber>
                <commercialPBTTransactionInformation>
                    <policyTypeCode></policyTypeCode>
                    <transactionExpirationDate></transactionExpirationDate>
                    <sourceSystemTransactionId></sourceSystemTransactionId>
                    <policyNumber></policyNumber>
                    <sourceSystemPolicyTermId></sourceSystemPolicyTermId>
                    <sourceSystemTransactionTypeName></sourceSystemTransactionTypeName>
                    <commercialPBTPolicyInformation>
                        <policySICCode></policySICCode>
                        <servicingAreaCustomerGroupAbbreviation></servicingAreaCustomerGroupAbbreviation>
                    </commercialPBTPolicyInformation>
                    <expiringPremiumAmount>0</expiringPremiumAmount>
                    <transactionEffectiveDate></transactionEffectiveDate>
                    <policyTypeSubCode></policyTypeSubCode>
                    <transactionGroupId></transactionGroupId>
                    <totalTransactionPremiumAmount></totalTransactionPremiumAmount>
                    <lostBusinessPremiumAmount>0</lostBusinessPremiumAmount>
                    <inceptionDate></inceptionDate>
                    <rateOfferedPercent>0</rateOfferedPercent>
                    <expirationDate></expirationDate>
                </commercialPBTTransactionInformation>
                <writingCompanyCode></writingCompanyCode>
                <riskStateOrProvince>
                    <postalStateAbbreviation></postalStateAbbreviation>
                </riskStateOrProvince>
                <producerNumber></producerNumber>
                <controlNumber></controlNumber>
                <producerSubNumber></producerSubNumber>
            </commercialProcessBoundTransaction>
            <lobtransactionOrderNumber>2</lobtransactionOrderNumber>
        </lineOfBusinessTransaction>
    </packagePolicyTransaction>
    <systemId></systemId>
    <processClassificationName> </processClassificationName>
    <userId></userId>
    <additionalOptionsText></additionalOptionsText>
    <additionalOptionsText></additionalOptionsText>
    <resumeActivityName></resumeActivityName>
    <lineOfBusinessTypeCode></lineOfBusinessTypeCode>
</PackagePBTransactionPostRequest>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题