Is there a (C#) library that will create feeds for Amazon Marketplace Web Services?

五迷三道 提交于 2019-12-03 16:32:08

问题


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).


回答1:


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


来源:https://stackoverflow.com/questions/2694649/is-there-a-c-library-that-will-create-feeds-for-amazon-marketplace-web-servic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!