oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Using Amazon's New Web Services

by Wei-Meng Lee
07/18/2002 recently launched its Web services initiatives, allowing customers to integrate its vast online content with their own Web site. This move follows the Web services launch of another major industry player, search engine Google, which launched its Web APIs Web service ( a few months ago. If you were familiar with Google's Web APIs, then's Web service won't be new to you. Both companies require you to obtain a free license key and download a developer kit for integrating your application with their content. Neither company has announced a fee plan for using the Web services as yet.'s Web services launch is welcome news. Publishers have been using to monitor their sales, book reviews, and most importantly, their competitors. Publishers often write custom applications to pull their books' sales rankings and ratings into their own databases, which in turn lets them gauge the performance of each individual title. Often the technique used to gather this information was screen-scaping, where a lot of reliance is placed on the format of the HTML document. With the launch of's Web services initiatives, publishers can now integrate the Web service into their in-house application for report generation and management reporting.

XML in a Nutshell

Related Reading

XML in a Nutshell
A Desktop Quick Reference
By Elliotte Rusty Harold, W. Scott Means

Besides benefiting publishers, Amazon's Web services also benefit Amazon's Associates, who earn a percentage of a product sale by referring site visitors to Amazon. Associates can now tap into Amazon's huge product database to better tailor their recommendations to its site visitors.

In this article, I will demonstrate how you can make use of the Amazon's Web service using Visual Studio .NET.

Downloading the Developer's Kit

The first step is to download the free Amazon Web Service Developer's Kit at (as shown in Figure 1).

Figure 1. Downloading the Web Service Developer's Kit.

You also need to apply for a free Developer's token. The token identifies you when accessing's Web service. Once you complete these steps, you're ready to roll.

Building Our Sample Application

We'll use Visual Studio .NET to build a Windows application and show how it can consume Amazon's Web service. Features we'll want built into the application will include the ability to search for book titles and check book information such as list price, Amazon's discounted price, customer's rating, and book cover image.

First, launch Visual Studio .NET and create a new Windows application project. Then add a Web Reference to point to Amazon's Web service. Normally, we'd just add the URL containing the WSDL of the Web service, if the Web service was developed using .NET (with an .asmx extension). However, in the case of Amazon, there is no URL to add to our Web Reference. Instead, the WSDL document itself is provided in the Developer's Kit. So, the next step is to manually create the Web service proxy using the WSDL.exe tool:

C:\>wsdl /language:vb /o:Amazon.vb AmazonWebServices.wsdl

The above step creates a proxy class in Visual Basic .NET. To use this proxy class in your project, add the Amazon.vb class to your project, as shown in Figure 2:

Figure 2. Adding the Web service proxy. class

You also need to add references to the System.Web and System.Web.Services assemblies. (This is because they are not automatically referenced in Windows application.)

Next, add in the various controls to our Windows Form, as shown in Figure 3:

Figure 3. Adding controls to our Windows Form.

We also want to be able to display the image of a book, so I suggest adding a Web Browser OCX control. Customizing the Toolbox allows you to add this control (see Figure 4):

Figure 4. Customizing the Toolbox.

Pages: 1, 2

Next Pagearrow