【问题标题】:Amazon Marketplace API ProductImage Feed unexpected element error while parsing xmlAmazon Marketplace API ProductImage Feed 解析 xml 时出现意外元素错误
【发布时间】:2014-03-22 21:47:58
【问题描述】:

我正在使用 java 中的 amazon mws feed api,在向亚马逊发送 ProductImage feed 时遇到了一些问题。

这是我要发送的 xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProductImage>
    <SKU>ABCDORD0001</SKU>
    <ImageType>Main</ImageType>
    <ImageLocation>http://vocearancio.ingdirect.it/wp-content/uploads/2013/01/bici-1.jpeg</ImageLocation>
</ProductImage>

这是网络服务响应(仅有趣的部分):

            <Result>
                <MessageID>1</MessageID>
                <ResultCode>Error</ResultCode>
                <ResultMessageCode>5000</ResultMessageCode>
                <ResultDescription>XML Parsing Error at Line 2, Column 15: Found unexpected element &apos;ProductImage&apos; while parsing the start of this &apos;AmazonEnvelope&apos; document. Children of this element will be ignored by the parser..</ResultDescription>
            </Result>

我不明白他为什么会忽略 ProductImage 标记,我正在按照文档中的示例进行操作,应该没问题。 我正在使用request.setFeedType("_POST_PRODUCT_IMAGE_DATA_"); 发送提要 是因为我缺少信封部分吗?我认为 java API 可以做到这一点,我对其他提要没有任何问题(即使产品没有显示在 sellecentral 库存中)。

这是我的 POST_PRODUCT_DATA 提要(我应该发送的第一个,而不是上面的那个),它没有错误地返回:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Product>
    <SKU>ABCDORD0001</SKU>
    <LaunchDate>2014-11-10T00:00:00.000+01:00</LaunchDate>
    <ReleaseDate>2014-11-10T00:00:00.000+01:00</ReleaseDate>
    <Condition>
        <ConditionType>New</ConditionType>
    </Condition>
    <DescriptionData>
        <Title>titolo_articolo</Title>
        <Brand>brand_item</Brand>
        <Description>descrizione_articolo_dett</Description>
        <ItemType>sotto_categoria</ItemType>
    </DescriptionData>
    <ProductData>
        <Sports></Sports>
    </ProductData>
</Product>

希望有人能帮忙。

【问题讨论】:

    标签: java xml xsd amazon-mws


    【解决方案1】:

    这听起来像是您正在使用 _POST_PRODUCT_DATA_ SubmitFeed 常量发送图像提要。

    相反,您需要使用_POST_PRODUCT_IMAGE_DATA_ 常量发送图像。有workflow here 的描述。查看Selling on Amazon, Guide to XML 以了解有关提要所需内容的详细信息。它在第 47/48 页提供了一个示例提要。

    【讨论】:

    • 我使用了正确的提要类型 (POST_PRODUCT_IMAGE_DATA),我编辑了问题。
    【解决方案2】:

    问题是我错过了 amazon-envelope 部分,这是我现在发送到 web 服务的正确 xml 的示例:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <AmazonEnvelope>
        <Header>
            <DocumentVersion>1.01</DocumentVersion>
            <MerchantIdentifier>A2UAUVMGTII0KR</MerchantIdentifier>
        </Header>
        <MessageType>Product</MessageType>
        <Message>
            <MessageID>1</MessageID>
            <OperationType>Update</OperationType>
            <Product>
                <SKU>ABCDORD0005</SKU>
                <StandardProductID>
                    <Type>ISBN</Type>
                    <Value>9788478888566</Value>
                </StandardProductID>
                <LaunchDate>2014-03-23T00:00:00.000+01:00</LaunchDate>
                <ReleaseDate>2014-03-23T00:00:00.000+01:00</ReleaseDate>
                <Condition>
                    <ConditionType>New</ConditionType>
                </Condition>
                <DescriptionData>
                    <Title>Harry Potter and the Philosopher's Stone</Title>
                    <Brand>brand_item</Brand>
                    <Description>Harry Potter and the Philosopher's Stone is the first novel in the Harry Potter series, written by J. K. Rowling.</Description>
                    <Manufacturer>J. K. Rowling</Manufacturer>
                    <ItemType>sotto_categoria</ItemType>
                </DescriptionData>
                <ProductData>
                    <Sports></Sports>
                </ProductData>
            </Product>
        </Message>
    </AmazonEnvelope>
    

    这很好用,没有返回错误,请注意,产品在卖家中心购物大约需要 1 分钟,而它需要 10 分钟才能被处理并激活。 此外,StandardProductID 元素非常重要,如果您不提供正确的代码,您将得到一个缺少密钥的错误作为回报。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-27
      • 1970-01-01
      • 1970-01-01
      • 2012-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多