Examples of Web Services: Amazon and Google
Real-world Web services will be examined in this chapter. This section is a bit more technical than other parts of the report, but nontechnical readers should not be intimidated by the programming code listed in the examples. Even nonprogrammers should be able to understand the gist of what these programs are trying to accomplish without having to have a keen grasp on the programming language. (I ask that programmers reading this report to bear with my unsophisticated programming style; more experienced programmers would write much more elegant code than my admittedly awkward efforts.)
Amazon Web Services
Amazon, one of the most popular commercial online businesses, offers a Web-service interface that provides a number of interesting features. The possibilities range from simple queries out of the Amazon catalogs to full-fledged e-commerce Web sites that operate in partnership with Amazon through the company's Amazon affiliates program.
Amazon.com has grown to be one of the most successful businesses on the Web. The company quickly established itself as a popular source for buying books on the Web and has expanded to sell many other types of products. In support of its extremely high-volume business, Amazon has developed a sophisticated, scaleable, and reliable technology infrastructure. On its own, Amazon is extremely successful, but an important part of its business strategy involves the company's efforts to go beyond its direct sales and to include affiliates and partners. For example, Amazon allows other individuals and organizations to make use of its infrastructure to sell their products and services in return for it receiving a small commission on each sale. This arrangement has proven to be beneficial for both Amazon and its affiliates. An individual or business can fairly easily set up his, her, or its own electronic store-front; this storefront features the e-commerce capabilities developed by Amazon, which would be much more difficult and expensive to create independently.
The mechanism that Amazon uses for expanding its online-business activities is based on Web services. Using Web-service technologies described in this report, Amazon Web Services (AWS) provide access to Amazon's technical infrastructure. AWS can be implemented using either SOAP or REST, but the majority of AWS implementations follow the simpler REST approach.
In order to begin using AWS, one must first set up an AWS developer account. Once registered, the user will receive a subscription ID, which will be used as a key to gain access when invoking Web services. Many of the Web services offered by Amazon can be used for free, although some require paid subscriptions or involve pay-per-use fees.
The core functionality of Amazon.com can be programmatically accessed through the Amazon E-Commerce Service (ECS). Amazon does not charge for use of ECS, though some restrictions apply regarding how information retrieved from Amazon in this way may be used and the number of transactions performed per second. (The WSDL [Web Services Description Language] that describes the ECS is available at: http://webservices.amazon.com/AWSECommerceService /AWSECommerceService.wsdl.)
Amazon offers extensive tools and documentation for building applications using AWS (http://aws.amazon.com). There are also a number of books and other resources available that provide extensive information on implementing applications based on AWS.
In the following text, I'll construct a very simple example that makes use of the Amazon Web Service (see appendix 3). The example will explain how the AWS functions to dynamically execute a search on Amazon-with a few lines of programming-to display the results.
This, and most of the other examples in this report, will use the Perl programming language, for no other reason than it is the one with which I am most comfortable. The platform for the examples consists of the following components:
* An Intel-based server running Windows XP Professional;
* The Perl programming language. …