As of December 5, 2006, we are no longer issuing new API keys for the SOAP Search API. Developers with existing SOAP Search API keys will not be affected.
Depending on your application, the AJAX Search API may be a better choice for you instead. It tends to be better suited for search-based web applications and supports additional features like Video, News, Maps, and Blog search results.
For developers who are already using the SOAP Search API, we've kept the documentation live on this site.
Did you know that Google provides a Web service for searching through Google's database, retrieving cached versions of Web pages, and performing spelling checks? Using Google's Web service you can provide Google's search functionality on your own Web site. Over the next month or so I plan on authoring two to three articles describing how to utilize Google's Web services. In this first article, we'll look at how to use the Web service to search through Google's database.
The Google Web Service API is currently in Beta testing, and is only available for personal use. To limit excessive use, Google requires that those who wish to use the Google Web service acquire a unique license key (which is free to obtain). This license key is used to limit individuals to no more than 1,000 calls to the Google Web service per day. Please be sure to read the license terms.
A Web service is an external interface provided by a Web site that can be called from other Web sites. Think of Web services as a self-contained component with one or more methods. This component can reside anywhere on the Internet, and can have its methods invoked by remote clients. For example, the Google Web service provides three methods: doGoogleSearch(), doGetCachedPage(), and doSpellingSuggestion(). The doGoogleSearch(), which we'll be examining in this article, has a number of input parameters that specify the search query. The method then returns an instance of the GoogleSearchResult object, which has the results of the search.
Web services are built on open protocols and standards. For example, the communication between a client that wishes to consume a Web service, and the Web service itself, happens over HTTP, a well-known, open protocol. The parameters and return values being passed back and forth are packaged using SOAP, a well-known, open protocol for data-marshalling. The relevant point here is that Web services can be exposed on, say, a Microsoft IIS Web server and be consumed by PHP Web pages running on Apache, by ASP.NET Web pages running on IIS 6.0, or even by a desktop application.
When consuming a Web service, typically a proxy class is created to shield the client from the complexity involved in invoking the Web service. A proxy class is a class that itself contains all of the methods and objects that the Web service exposes. These methods, when called from the client program, handle the marshalling of the parameters into SOAP, sending the SOAP request over HTTP, receiving the response from the Web service, and unmarshalling the return value. The proxy class allows the client program to call a Web service as if the Web service was a local component.
If you are unfamiliar with Web services, this primer serves as a good introduction, but you should definitely take the time to read Creating a Web Service and then Creating and Consuming a Web Service.
The Google Web Service information can be found online at http://www.google.com/apis/. To start using the Google Web Service you will first need to download the Google Web API Developer's Kit. This 666K file includes the WSDL (Web Service Description Language) file that fully describes the Web service, and examples of accessing the Google Web Service in both Java and VB.NET/C#.
After downloading the Google Web API Developer's Kit, you will need to create an account with Google. This can be done at: https://www.google.com/accounts/NewAccount?continue=http://api.google.com/createkey. Once you create one of these free accounts, you will be assigned a unique license number. This license number must be used whenever a Google Web service method is called. The purpose of this license is to limit the number of calls to the Google Web service to 1,000 invocations per license key per day.
In this article we saw how to call the Google search Web service. To use the Google Web services, we started by downloading the Google Web API Developer's Kit and then creating an account to obtain a license key. Following that, we created a proxy class based on the Google Web service's WSDL file (GoogleSearch.wsdl, which is included in the Developer's Kit download). Armed with this proxy class, we could then access the Web service with just a few lines of code from our ASP.NET Web page.