Introduction
The Google search engine can now be accessed via a SOAP-based Web service. This means that developers can now embed Google search results and other information into their own applications. Google also took this project one step further, creating an API and Java technology toolkit for accessing the data. This tutorial is for developers who want to use Google information from within their Java applications.
Developers need to be familiar with Java programming language, and will need an Internet connection to access the Google service. An understanding of Web services is not required to use the API.
Interest in Web services is booming, and now there is a practical application for them accessible to those outside large enterprise environments. Google has lately become the most popular search engine on the Web, and now they have made their index of 2 billion pages available to developers via a SOAP-based API in order to enable applications such as new content watchdogs, GUI search tools, and pattern analysis.
The Google API enables you to perform searches, retrieve cached pages from Google, and utilize Google's spell-checking capabilities. All of these capabilities can then be integrated into any application in an environment that supports Web services.
This tutorial demonstrates the creation of four separate applications:
- The first sends a search query to the Web service and retrieves and analyzes the individual and aggregated results using only Java skills.
- The second application retrieves a specific Web page from the Google cache.
- The third demonstrates Google's spelling suggestion capabilities.
- The last part of the tutorial discusses the different SOAP messages used by the Web service, and the process of sending them directly to the Google Web service. This fourth application uses JAXM to send and receive the messages, which are then transformed into useful results.
Make sure that the following tools are installed and tested before beginning the tutorial.
- Java 2 SDK, Standard Edition version 1.3.1 or higher: The sample applications demonstrate manipulation of the DOM through Java technology. You can download the Java SDK from http://java.sun.com/j2se/.
- The Google API, available at http://www.google.com/apis/.
- The last section of this tutorial deals with sending SOAP messages directly, rather than through the API. To run these samples, you'll need the Java API for XML Mess aging, or JAXM. It's available as part of the Java XML Pack, at http://java.sun.com/xml/downloads/javaxmlpack.html.

