首页 > 解决方案 > NodeJS Amazon AWS 提交提要一般错误

问题描述

我正在尝试向 AWS 提交产品提要,但我不断收到与我发送的 XML 相关的一般错误

我浏览了所有的 .xsd 文件并提出了我认为正确的 xml 但显然不是:(

错误

{
  "MessageID": "1",
  "ResultCode": "Error",
  "ResultMessageCode": "25",
  "ResultDescription": "We are unable to process the XML feed because one or more items are invalid. Please re-submit the feed."
}

我如何创建内容

const getContent = (upc) => `<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    <Header>
        <DocumentVersion>1.01</DocumentVersion>
        <MerchantIdentifier>${process.env.MERCHANT_ID}</MerchantIdentifier>
    </Header>
    <MessageType>Product</MessageType>
    <Message>
        <MessageID>1</MessageID>
        <OperationType>Update</OperationType>
          <Product>
              <SKU>${upc}</SKU>
          </Product>
    </Message>
</AmazonEnvelope>` 

标签: node.jsxmlamazon-web-servicesamazon-mws

解决方案


原来这只是意味着 xml 中的值格式错误。它有助于在 xsd 文件中搜索我试图将值绑定到的特定变量,然后它提供了对该值的限制(即 AmazonOrderId 具有与之关联的正则表达式验证,该验证将值限制在123-1234567-1234567)。在我为每个变量手动运行此过程后,我终于能够提交一个提要,但现在我必须有一个相关的 OrderAcknowledgement 我正在处理。


推荐阅读