Skip to main content
Published: March 30 2005, 8:47:00 PMUpdated: November 28 2020, 1:21:51 PM

There is an excellent Item Specifics (Attributes) sample that ships with the eBay SDK for Windows. This article shows you how to extend the sample to cache the metadata instead of downloading it every time the sample is run (which is the behavior out of the box and not very practical). This methodology can be used in real applications that make use of this sample directly or it's various implementations of the steps involved in creating a listing creation flow that involves Item Specifics.

The idea is to use the GetAttributesCSCall and GetAttributesXslCall to check for updates at DetailLevel 0 by checking the Version against your cached version. If a newer version is available then make the GetAttributesCSCall and GetAttributesXslCall again with DetailLevel 1 and store the Version number in a file on disk (this is your cache) and serialize the XML and XSL to files on disk.

To do the serialization, you can use the GetAttributesCSXml method of the GetAttributesCSCall class to get the XML, and the GetAttributesXSL method of the GetAttributesXSLCall class to get the XSL (as is done in the AttributesXmlDownloader and AttributesXslDownloader classes).

You can create your own Loader class much like the existing AttributesXmlDownloader class in the eBay.SDK.Attributes library, but instead of loading the mXml member directly from the GetAttributesCSCall, you can load it from the file on disk.

Even better than going and creating your own Loader class, you can take the existing AttributesLib source code and add your own code for a version check on the file on your disk and loading the mXml from disk into the DownloadXml function.

The key is to have a loader class that will load the mXml member from the file on disk instead of from the GetAttributesCSXml function of the GetAttributesCSCall every time you want to create a new instance of AttributesMaster.

Please see the source code in SDK\Source\DotNET\AttributesLib\AttributesMaster.cs in reference to the AttributesLib source code.

How well did this answer your question?
Answers others found helpful