Amazon Order Acknowledgment feed

2019-01-28 10:56发布

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?

标签: amazon-mws
1条回答
看我几分像从前
2楼-- · 2019-01-28 11:08

There are two problems with your XML code:

  1. 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)
  2. 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>
查看更多
登录 后发表回答