Home > SOA Tips > The Web Services Advisor > Lessons from the Front: How Amazon is using Web services, part two
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

THE WEB SERVICES ADVISOR

Lessons from the Front: How Amazon is using Web services, part two


Preston Gralla
09.24.2002
Rating: -4.20- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



The Web Services Advisor
(To receive this column in your inbox,
click Edit your Profile and subscribe.)
.

How Amazon is using Web services
In one of the widest uses of public Web services, Amazon has rolled out a program that allows Web site owners (what are called Amazon Associates) to include Amazon features and information on their sites and make money while doing so. In the previous column, we looked at the business aspects of Amazon's use of Web services. In this column, we'll take a look at some of the technical details and see some of the more innovative ways that Amazon Web services are being used.

What You Can Do With Amazon Web Services
Amazon's Web services program allows associates to create services that search for and retrieve product information from Amazon and to add Amazon products to shopping carts, wish lists, and gift and wedding registries – all without leaving the associates' sites. The associate can display the information however he wants and can pick and choose what information to display. This flexibility lets associates create different kinds of storefronts and buying opportunities on their own sites. Amazon pays associates a cut of every sale made this way.

In order to participate in the program and build a Web service, an associate has to obtain a token from Amazon. There's no cost involved. Those interested in the program should go to www.amazon.com/webservices for details. From this page, you can download a development kit, apply for a free token, and get more details about the program.

How To Build an Amazon Web Service
Amazon offers two methods of building Web services: XML/HTTP and SOAP. We'll take a look at each in turn.

In the XML/HTTP method of creating a Web service, an associate creates a URI (Universal Resource Identifier) that is passed to Amazon, and Amazon in turn sends back an XML document that the associates uses to display information on his site. Keywords as well as subject and category browses are passed to Amazon directly from the URI. The XML that results can be in one of two forms: a "lite" XML document that contains basic information about each Amazon product, such as a product's name and its price; or a "heavy" XML document that contains more comprehensive information, for example, sales ranking and customer reviews. On the associate's site, this information can be displayed however the associate wants, and the associate can pick and choose what information to display.

Doing a search on any individual attribute (such as reviews of product, a product's price, the name of an author or actress, etc.) can return multiple entries. For example, many Amazon products have more than 100 reviews associated with them. To streamline the display of information, and to simplify XML documents, Amazon has put a limit on how much information can be in the XML document returned to the associate: a maximum of ten authors, ten actors/actresses, ten artists, five similar products and three customer reviews.

For similar reasons, each XML document, whether it's "lite" or "heavy," can display a maximum of ten products on a page. If an associate wants to display a total of more than ten products, he passes a "page" parameter in the URI. For example, if an associates wanted to retrieve the top 30 books written by Stephen King, he would make three separate calls with the parameters page=1 (returns books #1 through #10), page=2 (books #11 through #20) and page=3 (books #21 through #30). The result would be three separate pages, each with a list of ten books.

Let's take a look at a simple example putting this all together. Let's say you wanted to generate a list of the bestselling books on the topic of the Internet. The format for requesting an XML document that returns results based on keywords is:

http://xml.amazon.com/onca/xml?v=1.0&t=webservices-20&dev-t=[Developer's token goes here]&KeywordSearch=[subject keyword goes here]&mode=[product line goes here]&type=[lite or heavy]&page=[page # goes here]&f=xml

So the exact URI we would use would be:

http://xml.amazon.com/onca/xml?v=1.0&t=webservices-20&dev-t=[Developer's token goes here]&KeywordSearch=Internet&mode=books&type=lite&page=1&f=xml

An XML document would be returned with the top ten books with the keyword of "Internet." This is an exceedingly simple example, because multiple keywords can be used, as well as other kinds of searches, including category browses and other kinds of searches as well.

The other method of searching Amazon's catalog and getting XML documents is using SOAP. The following is the form for making a keyword request using SOAP. As you can see, the basic information you request is the same as with the XML/HTTP example:

   <?xml version="1.0" encoding="UTF-8" ?>
   <SOAP-ENV:Envelope
   xmlns:SOAP ENV="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
   <namesp1:KeywordSearchRequest xmlns:namesp1="urn:PI/DevCentral/SoapService">
   <KeywordSearchRequest xsi:type="namesp1:KeywordRequest">
   <keyword xsi:type="xsd:string">[subject keyword goes here]</keyword>
   <page xsi:type="xsd:string">[page # goes here]</page>
   <mode xsi:type="xsd:string">[product line goes here]</mode>
   <tag xsi:type="xsd:string">webservices-20</tag>
   <type xsi:type="xsd:string">[lite or heavy]</type>
   <dev-tag xsi:type="xsd:string">[developer's token goes here]</dev-tag>
   <format xsi:type="xsd:string">xml</format>
   <version xsi:type="xsd:string">1.0</version>
   </KeywordSearchRequest>
   </namesp1:KeywordSearchRequest>
   </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

The one drawback with the SOAP method is that you can't use multiple keywords. Apart from that, however, you can request the same information.

A Look at Some of Amazon's More Intriguing Web Services
Although Amazon Web services are still in their infancy, some innovative and even amazing Web services have been built using them. Below are just a few examples.

For those who prefer a Google-style stripped-down searching interface to the normal Amazon interface that's filled with navigation, bells and whistles, check out the "Amazon Lite" site built using Web services at http://www.kokogiak.com/amazon/.

You can build your own customized storefront with Amazon Web services – and that storefront can be as specialized as you want. For example, the http://digicams.php9.com/digicams.php store sells only digital cameras available from Amazon.

For a mind-stretching way of browsing through related books, music and film, check out http://www.pmbrowser.info/amazon.html. It's a visual, interactive way of finding products that are related to one another.

If you're looking for a bit of diversion and are a fan of trivia games, try out a beat-the-clock type game in which you name the works of authors and actors at http://mockerybird.com/web-services/name/.

As these examples show, the success of Amazon's Web services effort will hinge to a great extent on how developers can use their creativity to extend and stretch Amazon's basic features. Judging on what's already been done, Amazon has gotten a solid head start.



About the Author

Preston Gralla, a well-known technology expert, is the author of more than 20 books, including "How the Internet Works," which has been translated into 14 languages and sold several hundred thousand copies worldwide. He is an expert on Web services and the author of a major research and white paper for the Software and Information Industry Association on the topic. Gralla was the founding managing editor of PC Week, a founding editor and then editor and editorial director of PC/Computing, and an executive editor for ZDNet and CNet. He has written about technology for more than 15 years for many major magazines and newspapers, including PC Magazine, Computerworld, CIO Magazine, eWeek and its forerunner PC Week, PC/Computing, the Los Angeles Times, USA Today, and the Dallas Morning News among others. As a well-known technology guru, he appears frequently on TV and radio shows and networks, including CNN, MSNBC, ABC World News Now, the CBS Early Show, PBS's All Things Considered and others. He has won a number of awards for his writing, including from the Computer Press Association for the Best Feature in a Computer Publication. He can be reached at preston@gralla.com.

For More Information:

  • Looking for free research? Browse our comprehensive White Papers section by topic, author or keyword.
  • Are you tired of technospeak? The Web Services Advisor column uses plain talk and avoids the hype.
  • For insightful opinion and commentary from today's industry leaders, read our Guest Commentary columns.
  • Hey Codeheads! Start benefiting from these time-saving XML Developer Tips and .NET Developer Tips.

  • Visit our huge Best Web Links for Web Services collection for the freshest editor-selected resources.
  • Visit Ask the Experts for answers to your Web services, SOAP, WSDL, XML, .NET, Java and EAI questions.
  • Couldn't attend one of our Webcasts? Don't miss out. Visit our archive to watch at your own convenience.
  • Choking on the alphabet soup of industry acronyms? Visit our helpful Glossary for the latest lingo.
  • Discuss this article, voice your opinion or talk with your peers in the SearchWebServices Discussion Forums.

Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
The Web Services Advisor
What to expect with the new JavaScript standardization (ECMAScript 5)
Restlet framework wrestles RESTful Web applications
3 tips for choosing whether to use EGL
Use SoaML to facilitate Model Driven Architecture
Enterprise mashup patterns act as API enablers
XQuery learns to write using XUF
Descriptive Languages for RESTful Services
Notable Python language update on view
Try XML-based Extensible Business Reporting Language (XBRL) for accounting reports
Whatever happened to ''X''?

APIs
Yahoo's Heilmann talks standards and API connectedness at The Ajax Experience
API monitoring from Apigee, "like Google Analytics for APIs"
JNBridge releases JNBridgePRO 4.1
Reporter's Notebook: Jack Vaughan on agile methodology
NEC and SAIC use SOA for first-responder app
Oracle dresses up its first Tuxedo transaction processor with SCA
HP sees Systinet-HP Quality Center integration driving better SOA outcomes
WSO2 supports PHP during 'growth spurt' driven by SOA
Google Chrome shifts architects' equations as V8 powers the browser
SimpleDB shows promise

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
XMLHttpRequest  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts