繁体   English   中英

亚马逊MWS API:-如何使用PHP将xml产品Feed上传到_POST_PRODUCT_DATA_

[英]Amazon MWS API: - how to upload xml product feeds using PHP to _POST_PRODUCT_DATA_

我在使用亚马逊MWS API时遇到问题,由于某种原因,我不断收到此错误消息

“第-1行第-1列的XML解析致命错误:文件过早结束。文件过早结束。”

我已经尝试了很多教程,示例,文档,SDK和其他内容。

一切都返回相同的消息。

这是我尝试通过xml api服务提交给亚马逊的xml文件的示例

谁能给我展示一些经过测试的有效代码来制作此产品或使用PHP完全上传任何产品?

<?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>xxxxx</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>true</PurgeAndReplace>
<Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Product>
        <SKU>1Z-500ABR-FLAT</SKU>
        <ProductTaxCode>A_GEN_TAX</ProductTaxCode>
        <LaunchDate>2005-07-26T00:00:01</LaunchDate>
        <DescriptionData>
            <Title>Lyric 500 tc Queen Flat Sheet, Ivory</Title>
            <Brand>Peacock Alley</Brand>
            <Description>Lyric sheeting by Peacock Alley is t
                he epitome of simple and classic elegance. The flat
                sheets
                and pillowcases feature a double row of hemstitchin
                g. The fitted sheets fit mattresses up to 21 inches
                deep.
                The sheets are shown at left with tone on tone mono
                gramming, please call for monogramming details and
                prices.
                Please note, gift wrapping and overnight shipping a
                re not available for this style.</Description>
            <BulletPoint>made in Italy</BulletPoint>
            <BulletPoint>500 thread count</BulletPoint>
            <BulletPoint>plain weave (percale)</BulletPoint>
            <BulletPoint>100% Egyptian cotton</BulletPoint>
            <Manufacturer>Peacock Alley</Manufacturer>
            <SearchTerms>bedding</SearchTerms>
            <SearchTerms>Sheets</SearchTerms>
            <ItemType>flat-sheets</ItemType>
            <IsGiftWrapAvailable>false</IsGiftWrapAvailable>
            <IsGiftMessageAvailable>false</IsGiftMessageAvailable>
            <RecommendedBrowseNode>60583031</RecommendedBrowseNode>
            <RecommendedBrowseNode>60576021</RecommendedBrowseNode>
        </DescriptionData>
        <ProductData>
            <Home>
                <Parentage>variation-parent</Parentage>
                <VariationData>
                    <VariationTheme>Size-Color</VariationTheme>
                </VariationData>
                <Material>cotton</Material>
                <ThreadCount>500</ThreadCount>
            </Home>
        </ProductData>
    </Product>
</Message>
<Message>

您的XML无效。 您需要将最后一行<Message>替换为</AmazonEnvelope> ,以使其成为有效的XML文档。

您还需要更改<Home>元素的结构以通过Amazon的XSD进行验证(我假设FurnitureAndDecor是正确的产品类型):

<Home>
    <ProductType>
        <FurnitureAndDecor>
            <Material>cotton</Material>
            <ThreadCount>500</ThreadCount>
            <VariationData>
                <VariationTheme>Size-Color</VariationTheme>
            </VariationData>
        </FurnitureAndDecor>
    </ProductType>
    <Parentage>variation-parent</Parentage>
</Home>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM