jakarta.xml.bind.UnmarshalException: unexpected element (uri:"", local:"BizData")

162 Views Asked by At

I am seeing error while un marshalling xml. I have xml with below tag but class name is different from jaxb class.

Expected elements are <{urn:iso:std:iso:20022:tech:xsd:head.001.001.02}AppHdr>,<{urn:iso:std:iso:20022:tech:xsd:head.003.001.01}BizData> at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallingContext.han Below is the Object factory class: private final static QName _BizData_QNAME = new QName("urn:iso:std:iso:20022:tech:xsd:head.003.001.01", "BizData");

/**
 * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: iso.std.iso._20022.tech.xsd.head_003_001
 * 
 */
public ObjectFactory() {
}

/**
 * Create an instance of {@link BusinessDataHeaderV01 }
 * 
 */
public BusinessDataHeaderV01 createBusinessDataHeaderV01() {
    return new BusinessDataHeaderV01();
}

/**
 * Create an instance of {@link BusinessApplicationHeaderEnvelope }
 * 
 */
public BusinessApplicationHeaderEnvelope createBusinessApplicationHeaderEnvelope() {
    return new BusinessApplicationHeaderEnvelope();
}

/**
 * Create an instance of {@link StrictPayload }
 * 
 */
public StrictPayload createStrictPayload() {
    return new StrictPayload();
}

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link BusinessDataHeaderV01 }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link BusinessDataHeaderV01 }{@code >}
 */
@XmlElementDecl(namespace = "urn:iso:std:iso:20022:tech:xsd:head.003.001.01", name = "BizData")
public JAXBElement<BusinessDataHeaderV01> createBizData(BusinessDataHeaderV01 value) {
    return new JAXBElement<BusinessDataHeaderV01>(_BizData_QNAME, BusinessDataHeaderV01 .class, null, value);
}

sample xml look like this :

DDRIE OCOD ABCDE1234 auth.092.001.03_ESMAUG_DATREJ_1.0.0 2023-08-01T09:40:39Z

Please find the below sample xml

549300FM54TXULUKO729<?xml version="1.0" encoding="UTF-8"?> <BizData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:head.003.001.01 head.003.001.02_DTCC.xsd"> <Hdr> <AppHdr xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:head.001.001.02 head.001.001.02.xsd"> <Fr> <OrgId> <Id> <OrgId> <Othr> <Id>DDRIE</Id> </Othr> </OrgId> </Id> </OrgId> </Fr> <To> <OrgId> <Id> <OrgId> <Othr> <Id>OCOD</Id> </Othr> </OrgId> </Id> </OrgId> </To> <BizMsgIdr>ABCDE1234</BizMsgIdr> <MsgDefIdr>auth.092.001.03_ESMAUG_DATREJ_1.0.0</MsgDefIdr> <CreDt>2023-08-01T09:40:39Z</CreDt> </AppHdr> </Hdr> <Pyld> <Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:auth.092.001.03 auth.092.001.03_ESMAUG_DATREJ_1.0.0.xsd" xmlns="urn:iso:std:iso:20022:tech:xsd:auth.092.001.03"> <DerivsTradRjctnSttstclRpt> <RjctnSttstcs> <Rpt> <RefDt>2023-08-01Z</RefDt> <TtlNbOfRpts>1</TtlNbOfRpts> <TtlNbOfRptsAccptd>1</TtlNbOfRptsAccptd> <TtlNbOfRptsRjctd>0</TtlNbOfRptsRjctd> <TtlNbOfTxs>0</TtlNbOfTxs> <TtlNbOfTxsAccptd> <All>0</All> <New>0</New> <Mod>0</Mod> </TtlNbOfTxsAccptd> <TtlNbOfTxsRjctd> <All>0</All> <New>0</New> <Mod>0</Mod> </TtlNbOfTxsRjctd> <RjctnSttstcs> <CtrPtyId> <RptgCtrPty> <LEI>549300FM54TXULUKO729</LEI> </RptgCtrPty> <RptSubmitgNtty> <LEI>549300FM54TXULUKO729</LEI> </RptSubmitgNtty> <NttyRspnsblForRpt> <LEI>549300FM54TXULUKO729</LEI> </NttyRspnsblForRpt> </CtrPtyId> <RptSttstcs> <TtlNbOfRpts>1</TtlNbOfRpts> <TtlNbOfRptsAccptd>0</TtlNbOfRptsAccptd> <TtlNbOfRptsRjctd>0</TtlNbOfRptsRjctd> </RptSttstcs> <DerivSttstcs> <DtldSttstcs> <TtlNbOfTxs>0</TtlNbOfTxs> <TtlNbOfTxsAccptd> <All>0</All> <New>0</New> <Mod>0</Mod> </TtlNbOfTxsAccptd> <TtlNbOfTxsRjctd> <All>0</All> <New>0</New> <Mod>0</Mod> </TtlNbOfTxsRjctd> <TxsRjctnsRsn> <TxId> <ActnTp>NEWT</ActnTp> <RptgTmStmp>2023-08-01T01:34:47Z</RptgTmStmp> <DerivEvtTmStmp> <Dt>2023-08-01</Dt> </DerivEvtTmStmp> <OthrCtrPty> <Lgl> <Id> <LEI>549300FM54TXULUKO729</LEI> </Id> </Lgl> </OthrCtrPty> <UnqIdr> <UnqTxIdr>TESTUTITESTUTITEST12TESTUTITESTUTITESTTESTUTITESTUTI</UnqTxIdr> </UnqIdr> </TxId> <Sts>ACPT</Sts> </TxsRjctnsRsn> </DtldSttstcs> </DerivSttstcs> </RjctnSttstcs> <RjctnSttstcs> <CtrPtyId> <RptgCtrPty> <LEI>549300FM54TXULUKO729</LEI> </RptgCtrPty> <RptSubmitgNtty> <LEI>549300FM54TXULUKO729</LEI> </RptSubmitgNtty> <NttyRspnsblForRpt> <LEI>549300FM54TXULUKO729</LEI> </NttyRspnsblForRpt> </CtrPtyId> <RptSttstcs> <TtlNbOfRpts>1</TtlNbOfRpts> <TtlNbOfRptsAccptd>0</TtlNbOfRptsAccptd> <TtlNbOfRptsRjctd>0</TtlNbOfRptsRjctd> </RptSttstcs> <DerivSttstcs> <DtldSttstcs> <TtlNbOfTxs>0</TtlNbOfTxs> <TtlNbOfTxsAccptd> <All>0</All> <New>0</New> <Mod>0</Mod> </TtlNbOfTxsAccptd> <TtlNbOfTxsRjctd> <All>0</All> <New>0</New> <Mod>0</Mod> </TtlNbOfTxsRjctd> <TxsRjctnsRsn> <TxId> <ActnTp>MODI</ActnTp> <RptgTmStmp>2023-08-01T01:34:47Z</RptgTmStmp> <DerivEvtTmStmp> <Dt>2023-08-01</Dt> </DerivEvtTmStmp> <OthrCtrPty> <Lgl> <Id> <LEI>549300FM54TXULUKO729</LEI> </Id> </Lgl> </OthrCtrPty> <UnqIdr> <UnqTxIdr>TESTUTITESTUTITEST12TESTUTITESTUTITESTTESTUTITESTUTI</UnqTxIdr> </UnqIdr> </TxId> <Sts>ACPT</Sts> </TxsRjctnsRsn> </DtldSttstcs> </DerivSttstcs> </RjctnSttstcs> </Rpt> </RjctnSttstcs> </DerivsTradRjctnSttstclRpt> </Document> </Pyld> </BizData>

please let me know if you have any solutions

Please let me know if any solutions

0

There are 0 best solutions below