Я использую сгенерированный XML-файл, но он не работает должным образом.
Это выдает ошибку. Там нет ObjectFactory с @XmlElementDecl.
Я использую ApacheCXF для RestAPI здесь.
Я новичок в ApacheCXF и сейчас совершенно не понимаю, почему возникает эта ошибка.
Вход:
15:14:55.605 ERROR [http-nio-8080-exec-1][[dispatcherServlet]] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Could not instantiate JAXBContext for class [class com.ail.xstore.xsdtypes.nrf.XstorePoslogOut]: 7 counts of IllegalAnnotationExceptions; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 7 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {http://www.datavantagecorp.com/xstore/}OrderType.
this problem is related to the following location:
at protected java.util.List com.ail.xstore.xsdtypes.nrf.Layaway.accountNumberOrItemIDOrDescription
at com.ail.xstore.xsdtypes.nrf.Layaway
at protected com.ail.xstore.xsdtypes.nrf.Layaway com.ail.xstore.xsdtypes.nrf.LineItem.layaway
at com.ail.xstore.xsdtypes.nrf.LineItem
at protected java.util.List com.ail.xstore.xsdtypes.dtv.TenderExchange.lineItem
at com.ail.xstore.xsdtypes.dtv.TenderExchange
at protected com.ail.xstore.xsdtypes.dtv.TenderExchange com.ail.xstore.xsdtypes.nrf.Transaction.tenderExchange
at com.ail.xstore.xsdtypes.nrf.Transaction
at protected java.util.List com.ail.xstore.xsdtypes.nrf.POSLog.transaction
at com.ail.xstore.xsdtypes.nrf.POSLog
at protected com.ail.xstore.xsdtypes.nrf.POSLog com.ail.xstore.xsdtypes.nrf.XstorePoslogOut.posLog
at com.ail.xstore.xsdtypes.nrf.XstorePoslogOut
There's no ObjectFactory with an @XmlElementDecl for the element {http://www.datavantagecorp.com/xstore/}OrderType.
this problem is related to the following location:
at protected java.util.List com.ail.xstore.xsdtypes.nrf.PreviousLayaway.accountNumberOrItemIDOrDescription
at com.ail.xstore.xsdtypes.nrf.PreviousLayaway
at public com.ail.xstore.xsdtypes.nrf.PreviousLayaway com.ail.xstore.xsdtypes.nrf.ObjectFactory.createPreviousLayaway()
at com.ail.xstore.xsdtypes.nrf.ObjectFactory
at protected java.util.List com.ail.xstore.xsdtypes.nrf.Layaway.accountNumberOrItemIDOrDescription
at com.ail.xstore.xsdtypes.nrf.Layaway
at protected com.ail.xstore.xsdtypes.nrf.Layaway com.ail.xstore.xsdtypes.nrf.LineItem.layaway
at com.ail.xstore.xsdtypes.nrf.LineItem
at protected java.util.List com.ail.xstore.xsdtypes.dtv.TenderExchange.lineItem
at com.ail.xstore.xsdtypes.dtv.TenderExchange
at protected com.ail.xstore.xsdtypes.dtv.TenderExchange com.ail.xstore.xsdtypes.nrf.Transaction.tenderExchange
at com.ail.xstore.xsdtypes.nrf.Transaction
at protected java.util.List com.ail.xstore.xsdtypes.nrf.POSLog.transaction
at com.ail.xstore.xsdtypes.nrf.POSLog
at protected com.ail.xstore.xsdtypes.nrf.POSLog com.ail.xstore.xsdtypes.nrf.XstorePoslogOut.posLog
at com.ail.xstore.xsdtypes.nrf.XstorePoslogOut
There's no ObjectFactory with an @XmlElementDecl for the element {http://www.datavantagecorp.com/xstore/}UnitOfMeasureCode.
this problem is related to the following location:
at protected java.util.List com.ail.xstore.xsdtypes.nrf.Sale.actualSalesUnitPriceOrAssociateOrDescription
at com.ail.xstore.xsdtypes.nrf.Sale
at protected com.ail.xstore.xsdtypes.nrf.Sale com.ail.xstore.xsdtypes.nrf.Member.sale
at com.ail.xstore.xsdtypes.nrf.Member
at protected java.util.List com.ail.xstore.xsdtypes.nrf.Kit.member
at com.ail.xstore.xsdtypes.nrf.Kit
at protected java.util.List com.ail.xstore.xsdtypes.nrf.Return.actualSalesUnitPriceOrAssociateOrDescription
at com.ail.xstore.xsdtypes.nrf.Return
at public com.ail.xstore.xsdtypes.nrf.Return com.ail.xstore.xsdtypes.nrf.ObjectFactory.createReturn()
at com.ail.xstore.xsdtypes.nrf.ObjectFactory
at protected java.util.List com.ail.xstore.xsdtypes.nrf.Layaway.accountNumberOrItemIDOrDescription
at com.ail.xstore.xsdtypes.nrf.Layaway
at protected com.ail.xstore.xsdtypes.nrf.Layaway com.ail.xstore.xsdtypes.nrf.LineItem.layaway
at com.ail.xstore.xsdtypes.nrf.LineItem
at protected java.util.List com.ail.xstore.xsdtypes.dtv.TenderExchange.lineItem
at com.ail.xstore.xsdtypes.dtv.TenderExchange
at protected com.ail.xstore.xsdtypes.dtv.TenderExchange com.ail.xstore.xsdtypes.nrf.Transaction.tenderExchange
at com.ail.xstore.xsdtypes.nrf.Transaction
at protected java.util.List com.ail.xstore.xsdtypes.nrf.POSLog.transaction
at com.ail.xstore.xsdtypes.nrf.POSLog
at protected com.ail.xstore.xsdtypes.nrf.POSLog com.ail.xstore.xsdtypes.nrf.XstorePoslogOut.posLog
at com.ail.xstore.xsdtypes.nrf.XstorePoslogOut
Конечная точка контроллера:
@RequestMapping(value = "/pos", method = RequestMethod.POST, consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@ExceptionMetered
public Acknowledgement processPos(@RequestBody XstorePoslogOut xstorePoslogOut) {
POSLog posLog = xstorePoslogOut.getPOSLog();
String messageId = "1";
log.info("posLogOut Recieved call for " + posLog.getTransaction().size()+" transactions");
List<DeltaTransaction> deltaTransactionList = new ArrayList<DeltaTransaction>();
Acknowledgement f = new Acknowledgement();
String transactionId = messageId;
f.setTransactionId(transactionId);
for(Transaction transaction : posLog.getTransaction()){
try {
if("RETAIL_SALE".equalsIgnoreCase(transaction.getTransactionType()) && !transaction.isCancelFlag()){
FcIdResponse fcIdResponse = fcDetailsCache.getFcDetail(transaction.getRetailStoreID().toString());
String fcId = fcIdResponse.getFcId();
log.info("retailStoreId: " + transaction.getRetailStoreID().toString() + " fcId: " + fcId);
List<LineItem> lineItems = transaction.getRetailTransaction().getLineItem();
for (LineItem lineItem : lineItems){
DeltaTransaction deltaTransaction = new DeltaTransaction();
deltaTransaction.setFcId(fcId);
List<Object> objects;
try {
objects = lineItem.getSale().getActualSalesUnitPriceOrAssociateOrDescription();
} catch (NullPointerException n){
continue;
}
setTheDeltaTransaction(objects, deltaTransaction);
deltaTransaction.setTransactionType(CommonConstants.TRANSACTION_TYPE.OVERWRITE.getStockStatus());
deltaTransaction.setSource(CommonConstants.SOURCEANDDESTINATION.OVERWRITE.getSource());
deltaTransaction.setDestination(CommonConstants.SOURCEANDDESTINATION.OVERWRITE.getDestination());
deltaTransaction.setTransaction(transaction.getTransactionType());
deltaTransactionList.add(deltaTransaction);
}
imsClient.processDeltaTransactions(deltaTransactionList, transactionId);
}
}catch (Exception ex){
log.error("XStoreDeltInventoryService.processPosLog Exception: ", ex);
f.setTransactionId("Failed to consume the SOAP request. Error message is : "+ ex.getMessage());
return f;
}
}
log.info("posLogOut ackn id: " + transactionId);
log.info("Request processed successfully and sent to IMS: " + transactionId);
return f;
}
Если вам нужно больше информации, я могу предоставить.