unganisha.org

Lathering with SOAP, Domino and the GoogleAPI

Thursday, January 16th 2003

Some time last year, Google released a public GoogleAPI. This meant that, from a script we could now query the Google search engine as if it were running locally. Quite a few applications have been created around these services for e.g. : GoogleFight and GoogleSmackdown.

So how does the GoogleAPI work?
The Google API set is a public SOAP 1.1 interface to the google search engine that can be queried by any registered user. In very simple terms this means, the Google API allows users to programmatically query Google, and recieve the response locally (for e.g. search results) in a standard, machine readable format (you guessed it, XML). In addition to Google, Amazon also allows querying of its products via SOAP web service.

So what exactly is SOAP?
SOAP is kinda like the big brother of the XML-RPC protocol (I discussed XML-RPC earlier, it might be a good idea to read that, if you are wondering what XML-RPC is about).
To get a quick 5 minute overview of SOAP and how it works, I would recommend "A Busy developers guide to SOAP 1.1" and if you have the patience, the SOAP 1.1 specification (Note that SOAP 1.1 is not a ratified w3c standard). While in principle SOAP and XML-RPC try to do the same thing, in reality they are quite different. You can read about the major differences over here.

Fine, so how do I access the Google API? And how do I do it from Domino?
To get started, you need:

  • To get access to the GoogleAPI you need to obtain a license key
  • You need to download the GoogleAPI toolkit (a small 600KB download)

All the above can be obtained from http://www.google.com/apis/

The API toolkit comes with an API reference, and a GoogleAPI.JAR file. This file is a Java wrapper library provided by Google that makes it very easy to query the GoogleAPI by hiding the mechanics of creating a SOAP connection and recieving the response from the google server.

Unfortunately....(Yeah! I knew it wasn't gonna be that easy...), I couldn't get this library to work on my trusty old Domino 5.05 server. The GoogleAPI.JAR file uses a version of the xml-apache-soap library, which is incompatible with the version of the Java virtual machine (JVM) and JDK shipped with the Domino 5 versions.

I was looking for a method that would be backward compatible between Domino 5 and 6.
Fortunately, the beauty of technologies like XML-RPC and SOAP lies in their simplicity and non-proprietary design (Ask me, I still can't understand what DCOM was about) . Using the standard java classes provided by Domino 5.05, it is fairly easy to query any of the Google web service APIs.

So here is a "How-To" article on querying Google via SOAP from Domino (of course, without surgically modifying the Domino JVM) . I have tested the method on Domino 5.05+ versions (haven't tested it on Domino 6 actually) , though it should work on 5.03+.

Read the Update

There is some more updated information on this post available

Comments

GoogleAPI

  by Moudar on Monday, July 21st at 07:54 PM

I have some problem withe using GoogleAPI
When I run My Project (Build in JBuilderx)
I have this exception
My Exception: com.google.soap.search.GoogleSearchFault: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: Connection timed out: connect; targetException=java.lang.IllegalArgumentException: Error opening socket: Connection timed out: connect]

Add your comment:

your name:

your e-mail (optional):

your website url (optional):

subject (optional):

your comment:

HTML is not allowed!