问题
I am using the Order Acknowledgment feed to cancel the order for Amazon. Below is the xml feed format that I am using to cancel the Amazon order.
I have successfully been able to submit this feed to MWS, but every time when I check the feed submission result it always gives this error
'The XML you submitted is ill-formed at the Amazon Envelope XML level at (or near) line 1, column 485'.
I created the xml format according to this Selling on Amazon: Guide to XML.
<?xml version="1.0"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_xxxxxx_108291953</MerchantIdentifier>
</Header>
<MessageType>OrderAcknowledgment</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderAcknowledgement>
<AmazonOrderID>123-1234567-1234567</AmazonOrderID>
<StatusCode>Failure</StatusCode>
<CancelReason>BuyerCanceled</CancelReason>
</OrderAcknowledgment>
</Message>
</AmazonEnvelope>
Can any one help me what i am missing here in the xml format?
回答1:
There are two problems with your XML code:
- Amazon uses "OrderAcknowledgement", not "OrderAcknowledgment". While that choice may be debatable, the XSDs do not leave any room for a different spelling. (this applies to the
MessageType
and both opening and closing XML tag, your spelling is correct for the opening tag only) CancelReason
is only valid inside<Item>
substructures.
The following XML validates:
<?xml version="1.0"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_xxxxxx_108291953</MerchantIdentifier>
</Header>
<MessageType>OrderAcknowledgement</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderAcknowledgement>
<AmazonOrderID>123-1234567-1234567</AmazonOrderID>
<StatusCode>Failure</StatusCode>
<Item>
<AmazonOrderItemCode>12345678901234</AmazonOrderItemCode>
<CancelReason>BuyerCanceled</CancelReason>
</Item>
<Item>
<AmazonOrderItemCode>12345678901235</AmazonOrderItemCode>
<CancelReason>BuyerCanceled</CancelReason>
</Item>
<Item>
<AmazonOrderItemCode>12345678901237</AmazonOrderItemCode>
<CancelReason>BuyerCanceled</CancelReason>
</Item>
</OrderAcknowledgement>
</Message>
</AmazonEnvelope>
来源:https://stackoverflow.com/questions/18254327/amazon-order-acknowledgment-feed