Amazon Order Acknowledgment feed

坚强是说给别人听的谎言 提交于 2019-11-28 09:14: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?


回答1:


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>


来源:https://stackoverflow.com/questions/18254327/amazon-order-acknowledgment-feed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!