Демаршаллизация не удается случайным образом с ошибкой как ниже 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{}
Реализация имеет модель, и JAXBContext создается в имени пакета как - JAXBContext jc = JAXBContext.newInstance ("com.transformer.generated"), который является именем пакета класса DirectPaymentConfirmationRequest – user3311050