tags:

views:

225

answers:

4

Does anyone know of a library out there (preferably in C#) that will take classes and generate XML or flat files suitable for feeds to Amazon Marketplace Web Services?

In other words, I'd like to do something like this:

        var feed = new AmazonProductFeed();
        var list = new AmazonProductList();

        var product1 = new AmazonProduct();
        product1.Name = "Product 1";
        list.Add(product1);

        var product2 = new AmazonProduct();
        product2.Name = "Product 2";
        list.Add(product2);

        feed.Products = list;
        // spits out XML compliant with Amazon's schema
        Console.Write(feed.ToXml());

It looks like the only code Amazon provides are wrappers for the web service itself and the directory-based transport utility (AMTU).

A: 

The .NET XML Schema Definition Tool can be used to generate classes from any XSD and can be used in conjunction with the XML Serializer to do what's described.

The Selling On Amazon Guide to XML (SOA-GuideToXML.pdf) does not contain references to the correct XSDs. The links are inconsistent with the XSDs that are reprinted in the document. My old link to correct XSDs is no longer valid. My best guess is that they can be found here (requires a Seller Central login).

This (very long) command will generate all the needed classes so far as I know. Note that you will need to make some minor changes in the generated file. I don't remember which way it worked, but I either needed to change certain 2-D arrays to 1-D arrays ([][] to []) or vice-versa. I remember the places where I had to make these changes being fairly obvious:

xsd xsd\amzn-base.xsd xsd\amzn-envelope.xsd xsd\amzn-header.xsd xsd\AttributeGroups.xsd xsd\AutoAccessory.xsd xsd\Beauty.xsd xsd\CameraPhoto.xsd xsd\CatPIL.xsd xsd\CE.xsd xsd\ClothingAccessories.xsd xsd\Customer.xsd xsd\CustomerAddress.xsd xsd\FoodAndBeverages.xsd xsd\FulfillmentCenter.xsd xsd\FulfillmentOrderCancellationRequest.xsd xsd\FulfillmentOrderRequest.xsd xsd\Gourmet.xsd xsd\Health.xsd xsd\Home.xsd xsd\HomeImprovement.xsd xsd\Image.xsd xsd\Inventory.xsd xsd\Item.xsd xsd\Jewelry.xsd xsd\Lighting.xsd xsd\Listings.xsd xsd\ListingSummary.xsd xsd\Loyalty.xsd xsd\MerchantListingsReport.xsd xsd\Miscellaneous.xsd xsd\MultiChannelOrderReport.xsd xsd\Music.xsd xsd\MusicalInstruments.xsd xsd\NavigationReport.xsd xsd\Offer.xsd xsd\Office.xsd xsd\OrderAcknowledgement.xsd xsd\OrderAdjustment.xsd xsd\OrderFulfillment.xsd xsd\OrderNotificationReport.xsd xsd\OrderReport.xsd xsd\Override.xsd xsd\PaymentMethod.xsd xsd\PetSupplies.xsd xsd\Price.xsd xsd\ProcessingReport.xsd xsd\Product.xsd xsd\ProductAttributes.xsd xsd\ProductClothing.xsd xsd\ProductImage.xsd xsd\Relationship.xsd xsd\ReverseFeed.xsd xsd\SettlementReport.xsd xsd\Sports.xsd xsd\Store.xsd xsd\SWVG.xsd xsd\TiresAndWheels.xsd xsd\Tools.xsd xsd\ToysBaby.xsd xsd\TypeDefinitions.xsd xsd\Video.xsd xsd\WebstoreItem.xsd xsd\Wireless.xsd  /c /n:WebLinc.Services.Amazon.Marketplace > output.txt 2>&1
pause
Josh Kodroff
A: 

Josh, I am looking for the same result. Could you give some direction on what you did to make this work? I am new to the schema definition tool and was just wondering how you managed to get bypass your problem. Thanks, Shane

Shane Shearer
Shane, questions like this should be comments to my answer. I've updated my answer with what I know. If you have additional questions, please add comments to my answer.
Josh Kodroff
Shane, my answer was updated again with the correct command.
Josh Kodroff
A: 

There is a SilverLight4.0 online template available with VS2010, to read the feeds from Twitter. I hope the same with a little tweaking can help you, achieve what you want.

Siva Gopal
Siva, these are feeds for sending products to and reading orders from Amazon Marketplace. It has nothing to do with feeds like Twitter.
Josh Kodroff
A: 

Josh could you please put the correct xsd in external link because every time i try to open the link after i log in the website tells me "You do not have permission to view this page" although i am logged in

Thanks

m_1100
I updated the link, but I don't think that's all of the XSD files. Contact seller support here if they aren't right (Don't email [email protected]. They were near useless.) https://sellercentral.amazon.com/gp/contact-us/contact-amazon-form.html/ref=xx_contactus_conr_help
Josh Kodroff
BTW, this belongs as a comment on my answer, not an answer to my question.
Josh Kodroff