Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

C/C++

Amazon Web Services


December, 2005: Amazon Web Services

Ashish is the chief technology officer and Justin is a software engineer at Scanbuy. They can be reached at [email protected] and [email protected], respectively.


REST versus SOAP


ScanZoom is an application that lets you use mobile camera phones to launch services and applications simply by taking a photo of a barcode. For example, say you're shopping at Fry's Electronics and want to compare iPod prices with other retailers. You could take a picture of the barcode on the iPod packaging (or enter the barcode value manually) and ScanZoom finds out and reports on what that same iPod costs at competing retailers.

Developed at Scanbuy (where we work), ScanZoom can be installed by first downloading the application onto a PC from http://www.scanzoom.com/, and then installing it on mobile phones (via BlueTooth, infrared, WAP, or SMS), or by embeddable microchips.

In developing ScanZoom, we had two requirements that the data source needed to provide:

  • A large, extensive database.
  • Access to the Web without the need for monotonous manual entry or navigation.

Because of the size of Amazon's product database and its vast amount of information, Amazon's freely available web service API was the first resource we turned to. In particular, Amazon's E-Commerce Service (ECS) provides access to all of the content on the product pages of the Amazon.com site in an XML format.

From our perspective, Amazon's ECS (http://www.amazon.com/aws/) revolutionizes what a web service can do for developers. The service gives you direct, real-time access to all of Amazon's features, including consumer reviews, new and used product listings from individuals and companies, and a list of similar products that can be purchased along with almost all category-specific details that you can imagine. This service let us take ScanZoom to the next level and link mobile phones with the power of Amazon.

Providing information that would not be readily available to users holding products in their hands was essential. If all we offered were those basic details, what good would the application be to the consumer? Users would be able to see most, if not all, of the basic information while scanning the barcode on the package. ECS provided us with extra information, which would be helpful to a consumer in making a decision while shopping. For example, many people read consumer reviews before selecting a product to purchase. Through ECS, we can offer shoppers quick access to this information so that they can read each and every review that Amazon has on a product. Shoppers can then make an informed decision without having to research the product before leaving home. The application is also able to show similar products that are offered so that consumers are able to see other options and read reviews on those items before making a decision.

Still, pricing is one of the main reasons that consumers shop the Internet. However, comparing prices requires research, and many purchases are impulse buys made while shopping for other items and no research has been done. Through our application, users can instantly gain access to not only the price that Amazon offers, but to the price that retailers in the Amazon network provides. Because many of these retailers (Target and Circuit City, for instance) have large retail stores, they can go to another retailer to make their purchase at a discount. Users can also save more money by buying used items through Amazon. The used item prices are shown on the handset, along with the seller's rating and a description of item quality and condition.

Specific product information is joined by the item's packaging information, such as DVD movie run time, CD release date and track listing, and the like. Having all of this information combined into one data feed made it possible for us to pull up all of this information with a single search. The process of integrating the web service into our current web application was also fairly simple because Amazon offers a WSDL that we are able to connect to inside our C#.NET development environment. Creating a reference in the project to the URL of the ECS WSDL is all it took to have access to all the data types and functions necessary to gather our product information. Example 1 is a sample connection and query that returns an Amazon Item data type containing all the products from the search, along with the relevant item information. That's all that's involved in fetching Amazon's product information.

This query is also very customizable. Because we are dealing with mobile devices with limited memory and bandwidth, we need to make sure that the page being retrieved by the mobile browser is as compact as possible. We are able to efficiently do that by limiting the searchRequest.ResponseGroup to an array of only the response groups that are necessary for what is being displayed on the phone. For example, if you only need to know the item's price from Amazon along with some basic item details (such as category), you can simply have the response group set to "Small" (also offered are "Medium" and "Large"). Those response groups contain an array of smaller response groups. Instead of picking "Medium" or "Large" when you need more than just the basic information, you call on only those response groups that are needed, such as the ones that are listed on line 6 in Example 1.

You can further reduce the time it takes to return data to the mobile handset by searching in exact categories with more exact search criteria. In Example 1 (line 8), we are using a Blended SearchIndex. However, you could specify Books or Movies instead. We don't use this query when doing the initial search based on UPC or ISBN, but when we are requesting the "Reviews" or "Similar Products," we use it to minimize the irrelevant results and make the data set smaller.

Most of the development we did to integrate ECS into our web application was as simple as Example 1. However, we did run into a snag here and there. For example, we needed to display products from different categories on the same page template. The item information that is returned in the Item data type from ECS has different names for item details depending on the item category. For instance, the artist of a CD would be reached from Item.ItemAttributes.Artist, while the writer of a book would be Item.ItemAttributes.Writer. To solve this issue, we find the Item.ItemAttributes.ProductCategory, then list the item details based on that category. This was the only issue that we faced and it was definitely not a major issue, just a small bump in the road.

Using ECS, our application offers users a mobile shopping and pricing guide that is simple and fast to use. Developing the solution was almost as easy and let us offer users something that they couldn't previously get on their cell phone without a lot of keyboard pecking and squinting at a small screen.

DDJ


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.