Java Reference
In-Depth Information
Now that you have included the Google package, you can make use of the Google class-
es. Some of the more common Google classes that you will make use of are:
• GoogleSearch
• GoogleSearchResult
• GoogleSearchResultElement
The recipes shown later in this chapter will demonstrate how to make use of these class-
es.
Hybrid Bots
A hybrid bot makes use of both web services and conventional HTML based web access.
The Google web services API is very useful for creating hybrid bots. The Google search API
allows you to quickly locate pages for your bot to visit.
Consider if you wanted to create a bot that downloaded information about “George Wash-
ington”. It would take a very long time to construct a bot that would visit every site on the
web looking for information about “George Washington”.
Thanks to the Google search API, you do not need to construct such a bot. You can sub-
mit a search request to the Google API, and you will be given a list of all web pages that con-
tain the name “George Washington”. Your bot can then access these sites using the methods
previously discussed in this topic. Recipe 11.3 demonstrates a hybrid bot.
Understanding SOAP
When you make use of the Google API, your computer is sending requests to Google
and receiving responses back. You might be wondering what format these requests and re-
sponses are in. Most web services make use of the HTTP protocol called Simple Object Ac-
cess Protocol (SOAP) to send and receive requests and responses.
SOAP is a standard format for representing web service requests and responses. SOAP
is XML based and can be processed using the Document Object Model (DOM) or any of a
large number of framework libraries designed to make it easy to access SOAP. Later in this
chapter you will be shown how to use AXIS, which is a SOAP access framework provided
by Apache. For now, we will examine SOAP directly, and see what messages are sent and
received by it.
You can see a simple SOAP server at the following URL:
http://www.httprecipes.com/1/11/
Search WWH ::




Custom Search