O'Reilly logo

Java Servlet & JSP Cookbook by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 27. Using the Google and Amazon Web APIs

Introduction

Google and Amazon.com are both early adopters in the emerging field of web services.

Google is a giant web search engine and directory. Amazon.com is a e-commerce web site that began as an online bookstore and has since branched out into numerous products such as software and electronics. Both sites separately offer software developers web services Application Programming Interfaces (APIs) that give you the ability to manage Google searches using Java objects and access Amazon’s comprehensive product catalogs with your Java code.

For us Java developers, web services means making requests and receiving responses using a special XML format. In other words, you make a request using XML elements and attributes in text form, and receive a response in the same format. Web services typically use an XML-based protocol named Simple Object Access Protocol (SOAP) to transfer information.

In a nutshell, SOAP represents the abstraction of an envelope, that in turn contains optional headers and the message body. The message, composed of its outer envelope, as well as the headers and body, is made up of XML elements that are associated with specified namespaces. The technologies this chapter describes use HTTP to carry these XML-based SOAP messages.

I never really understood SOAP messages until I looked at some samples. Example 27-1 is part of a SOAP response to an Amazon Web Services keyword-search request using the query “Lance Armstrong.” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required