2014-02-14 31 views
0

解組以誤差如下 javax.xml.bind.UnmarshalException 隨機失敗 - 與鏈接的異常: [異常[的EclipseLink-25008](Eclipse持久服務 - 2.3。 2.v20111125-r10461):org.eclipse.persistence.exceptions.XMLMarshalException 異常說明:默認的根元素DirectPaymentConfirmationRequest描述符項目]的EclipseLink-25008:javax.xml.bind.UnmarshalException

XSD未發現

<?xml version="1.0" encoding="utf-16"?> 
    <xs:schema xmlns="http://test.com/Ft/Pare/DirectPayment/Message/Confirmation/Request/v0.10" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"> 
    <xs:element name="DirectPaymentConfirmationRequest"> 
     <!—additional child elements 
    </xs:element> 
    </xs:schema> 

XML input – 
    <?xml version="1.0" encoding="UTF-16"?> 
    <DirectPaymentConfirmationRequest> 
    <DirectPaymentReferenceId>12345</DirectPaymentReferenceId> 
    <PaymentCardTransactionType>ECommerceAuthorisation</PaymentCardTransactionType> 
    <Amount>10</Amount> 
    <MerchantId>1111</MerchantId> 
    <AddressCheckRequested>true</AddressCheckRequested> 
    <AuthorisationTimeStamp>2014-02-14T13:55:50.739Z</AuthorisationTimeStamp> 
    <AcquirerResponse> 
     <ResponseCode>333</ResponseCode> 
     <AuthorisationCode>123456</AuthorisationCode> 
     <AddressCheckResult>Y</AddressCheckResult> 
     <CVVCheckResult>Y</CVVCheckResult> 
     <ProductCode>MAE</ProductCode> 
     <TraceId>9722461401</TraceId> 
    </AcquirerResponse> 
    <CardDetail> 
     <PaymentCardType>Visa</PaymentCardType> 
     <PanToken>232323</PanToken> 
     <ExpiryDate>2018</ExpiryDate> 
     <LastFourDigits>1234</LastFourDigits> 
     <BinNumber>123456</BinNumber> 
     <CardState>NewCard</CardState> 
    </CardDetail> 
    </DirectPaymentConfirmationRequest> 

Java code 
    package com.transformer.generated; 
    @XmlAccessorType(XmlAccessType.FIELD) 
    @XmlType(name = "", propOrder = { 
    "directPaymentReferenceId", 
    "paymentCardTransactionType", 
    "amount", 
    "merchantId", 
    "addressCheckRequested", 
    "authorisationTimeStamp", 
    "acquirerResponse", 
    "error", 
    "cardDetail" 
} ) 
    @XmlRootElement(name = "DirectPaymentConfirmationRequest") 
    public class DirectPaymentConfirmationRequest 
    implements Serializable{} 

回答

0

您需要確保在引導JAXBContext時包含DirectPaymentConfirmationRequest類。如果你是從Java類白手創業,你可以這樣做:

JAXBContext jc = JAXBContext.newInstance(DirectPaymentConfirmationRequest.class); 

如果生成的模型,那麼您可以在生成的模型的包名創建JAXBContext

+0

實現具有模型,JAXBContext在包名稱上創建爲 - JAXBContext jc = JAXBContext.newInstance(「com.transformer.generated」),它是DirectPaymentConfirmationRequest類的包名稱 – user3311050

相關問題