video-reviews.net
video-reviews.net

Reputation: 2926

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

I am having a problem with the Amazon MWS API For some reason i keep on getting this error message

"XML Parsing Fatal Error at Line -1, Column -1: Premature end of file. Premature end of file."

I have tried lots of tutorials, examples, documentations, sdks and various.

Everything is returning the same message.

Here is an example of my xml file i am trying to submit to amazon via the xml api service

Can anybody show me some tested and working code to make this product or any product at all upload using 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>

Upvotes: 0

Views: 3235

Answers (1)

Hazzit
Hazzit

Reputation: 6882

Your XML is invalid. You need to replace the last line <Message> with </AmazonEnvelope> to make it a valid XML document.

You also need to change the structure of your <Home> element to validate with Amazon's XSDs (I'm assuming FurnitureAndDecor is the correct product type):

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

Upvotes: 1

Related Questions