node.js - 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>`
解决方案
原来这只是意味着 xml 中的值格式错误。它有助于在 xsd 文件中搜索我试图将值绑定到的特定变量,然后它提供了对该值的限制(即 AmazonOrderId 具有与之关联的正则表达式验证,该验证将值限制在123-1234567-1234567)。在我为每个变量手动运行此过程后,我终于能够提交一个提要,但现在我必须有一个相关的 OrderAcknowledgement 我正在处理。
推荐阅读
- apache-spark - 无法将数据写入配置单元中的内部表
- google-sheets - 获取特定日期和时间的数据
- spring-boot - spring boot 在运行测试类时没有选择测试属性
- octave - 八度精度波动
- swift - 映射单个 CoreData 属性
- c# - .NET 导致私有数据内存泄漏?
- python - Python Selenium:仍在努力掌握配置文件和选项的工作方式:尝试禁用 Firefox 弹出密码管理器
- javascript - 如何访问我的分页 html 文档中的 if 函数中的变量“page”?
- mysql - 表和视图的列类型不同
- html - 将浏览器从移动尺寸调整为 PC 时删除 iframe 下方的空白