亚马逊 MWS 订单确认返回错误 25:我们无法处理 XML 提要,因为一件或多件商品无效 [英] Amazon MWS order acknowledgement returning error 25: We are unable to process the XML feed because one or more items are invalid

查看:41
本文介绍了亚马逊 MWS 订单确认返回错误 25:我们无法处理 XML 提要,因为一件或多件商品无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过亚马逊 MWS 向亚马逊提交订单确认时遇到了一些问题.

I am having some trouble submitting an order acknowledgement to Amazon via the Amazon MWS.

我提交的 XML 是:

The XML I am submitting is:

<?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>F85S4E7G4FSE98</MerchantIdentifier>
   </Header>
   <MessageType>OrderAcknowledgment</MessageType>
   <Message>
    <MessageID>1</MessageID>
    <OrderAcknowledgment>
      <AmazonOrderID>654-8547853-2598634</AmazonOrderID>
      <MerchantOrderID>658795124</MerchantOrderID>
      <StatusCode>Success</StatusCode>
      <Item>
        <AmazonOrderItemCode>35287489587654</AmazonOrderItemCode>
        <MerchantOrderItemID>587487</MerchantOrderItemID>
        <AmazonOrderItemCode>35287489587655</AmazonOrderItemCode>
        <MerchantOrderItemID>587488</MerchantOrderItemID>
      </Item>
    </OrderAcknowledgment>
  </Message>
</AmazonEnvelope>

在提交 XML 时,亚马逊返回的错误是:
错误 25:我们无法处理 XML 供稿,因为一项或多项无效.请重新提交 Feed.

On submitting the XML the error returned by Amazon is:
Error 25: We are unable to process the XML feed because one or more items are invalid. Please re-submit the feed.

我按照 XML 文档指南.

基于这个堆栈溢出问题多个项目的格式是对的.

Based on this Stack Overflow question the format for multiple items is correct.

我已经根据 XSD 文件检查了我的数据,并且 XML 似乎有效
https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/OrderAcknowledgement.xsd
https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/amzn-base.xsd

I have checked my data against the XSD files and the XML seems valid
https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/OrderAcknowledgement.xsd
https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/amzn-base.xsd

我曾尝试使用 XML XSD 验证器来验证 XML,但它返回错误:
Src-resolve:无法将名称AmazonOrderID"解析为 A(n)元素声明"组件.

I have tried using an XML XSD validator to validate the XML, but it returns the error:
Src-resolve: Cannot Resolve The Name 'AmazonOrderID' To A(n) 'element Declaration' Component.

这个错误对我来说没有多大意义,但我相信它是由于我无法在验证器中正确引用的其他 XSC 的大量包含而返回的.AmazonOrderID"的限制位于 amzn-base.xsd 文件中,与我提供的 AmazonOrderID 匹配

This error does not make much sense to me, but I believe it is being returned due to numerous inclusions of other XSC that I cannot properly reference in the validator. The restrictions for the 'AmazonOrderID' are located in the amzn-base.xsd file and match the AmazonOrderID I have provided

<xsd:element name="AmazonOrderID">
  <xsd:simpleType>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\w{3}-\w{7}-\w{7}"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:element>

我已尝试按顺序确认单个项目,以防多个项目的结构不正确
我已尝试完全删除项目部分,因为我阅读了有时不需要项目部分
我尝试通过我创建的 php 脚本提交,该脚本成功处理了所有其他请求
我尝试通过亚马逊暂存器提交:https://mws.amazonservices.co.uk/scratchpad/index.html

I have tried acknowledging a single item in the order incase the structure for multiple items is incorrect
I have tried removing the items section completely as I read the items section is sometimes not needed
I have tried submitting via a php script I have created which handles all other request successfully
I have tried submitting via the Amazon scratchpad: https://mws.amazonservices.co.uk/scratchpad/index.html

我尝试过的任何方法都无法解决问题,而且我完全没有想法
如果您能提供任何帮助,我们将不胜感激

Nothing I have tried has resolved the issue and I am all out of ideas
Any help you could provide would be greatly appreciated

谢谢

推荐答案

我目前正在尝试获取所有必要的 XSD 以实际验证 MWS 文件,但到目前为止运气不佳.如果缺少单个 XSD,即使其内容与当前正在验证的文件无关,大多数验证器也会窒息.亚马逊确实很难真正验证东西——除非我遗漏了一些明显的东西.

I'm currently trying to get a hold of all necessary XSDs to actually validate MWS files, but with little luck so far. Most validators will choke if a single XSD is missing, even if its contents are not relevant to the file it is currently validating. Amazon sure does make it hard to actually validate stuff- unless I'm missing something obvious.

我的临时解决方案是使用一个残缺的"XSD,它只链接到我实际拥有副本的其他 XSD.使用这个文件并不完美,但总比没有好.这些 XSD 的嵌套方式,我可以用 XSD 验证的任何内容实际上都是有效的.唯一的缺点是存在我无法验证的有效 XML,我必须忍受.

My interim solution is to use a "crippled" XSD that only links to other XSDs that I actually have a copy of. Using this file is not perfect, but better than nothing. The way these XSDs are nested, anything I can validate with my XSD is actually valid. The only downside is that valid XMLs exist that I cannot validate, that I have to live with.

使用这组 XSD,我必须对您的 XML 进行以下更改才能通过验证:

Using this set of XSDs, I had to make the following changes to your XML in order to pass validation:

  1. 将 MessageType 更改为 OrderAcknowledgement(g 后面的额外e".您是否喜欢该拼写可能取决于您居住在池塘的哪一侧,但 XSD 命令可以准确拼写)
  2. 将开始和结束标签都更改为 OrderAcknowledgement(同上)
  3. 将该项目一分为二(StackOverflow 问题链接有误)

(我开始写这个答案的印象是 CM Serperg-McQueen 把拼写搞混了……我又读了一遍,结果证明他是对的,我应该提高我的阅读能力技能)

(I started writing this answer under the impression of C. M. Serperg-McQueen getting the spelling mixed up... I just read it again, and as it turns out, he was spot on, and I'm should improve my reading skills)

有关 AmazonOrderID 的验证器消息具有误导性.这很可能是因为该验证器还缺少 XSD 的某些部分.

The validator message regarding AmazonOrderID was misleading. It was most probably a result of that validator also missing parts of the XSD.

只是为了完整性.此文件通过了(残缺的)验证:

Just for the sake of completeness. This file passed the (crippled) validation:

<?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>F85S4E7G4FSE98</MerchantIdentifier>
   </Header>
   <MessageType>OrderAcknowledgement</MessageType>
   <Message>
    <MessageID>1</MessageID>
    <OrderAcknowledgement>
      <AmazonOrderID>654-8547853-2598634</AmazonOrderID>
      <MerchantOrderID>658795124</MerchantOrderID>
      <StatusCode>Success</StatusCode>
      <Item>
        <AmazonOrderItemCode>35287489587654</AmazonOrderItemCode>
        <MerchantOrderItemID>587487</MerchantOrderItemID>
      </Item>
      <Item>
        <AmazonOrderItemCode>35287489587655</AmazonOrderItemCode>
        <MerchantOrderItemID>587488</MerchantOrderItemID>
      </Item>
    </OrderAcknowledgement>
  </Message>
</AmazonEnvelope>

这篇关于亚马逊 MWS 订单确认返回错误 25:我们无法处理 XML 提要,因为一件或多件商品无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆