At the Forge - Google Web Services

With a little SOAP, cleanliness is next to Googliness.

Most people, including myself, typically want to query the widest possible number of Web pages with our queries; however, there are times when it is more appropriate to retrieve data only from servers in a particular geography or in a certain language. The fact that Google's API makes this possible and straightforward opens the door for many different interesting applications.

Just as we send a query to Google via SOAP-encoded XML, we receive a result in SOAP-encoded XML. But as SOAP::Lite shielded us from having to write even a tiny bit of XML for the query, we similarly will be insulated when it comes to the response. The $results variable provides a Perl interface to the data that we received in response.

And exactly what data will we receive? To know that, we can look at the WSDL file once again. It indicates (among other things) that we will receive responses as a set of results, each of which looks like this:


<xsd:complexType name="ResultElement">
<xsd:all>
    <xsd:element name="summary" type="xsd:string"/>
    <xsd:element name="URL" type="xsd:string"/>
    <xsd:element name="snippet" type="xsd:string"/>
    <xsd:element name="title" type="xsd:string"/>
    <xsd:element name="cachedSize" type="xsd:string"/>
    <xsd:element name="relatedInformationPresent" type="xsd:boolean"/>
    <xsd:element name="hostName" type="xsd:string"/>
    <xsd:element name="directoryCategory" type="typens:DirectoryCategory"/>
    <xsd:element name="directoryTitle" type="xsd:string"/>
</xsd:all>
</xsd:complexType>

In other words, each search result we receive back from Google (up to a maximum of ten) will provide all of the information we need to create a results page that looks just like Google's. Moreover, we can pick and choose the elements we want to display, showing (for example) only the title and the dmoz directory category and title. Or we can show a short snippet from the searched page. Or all of these. Or none of these.

doGoogleSearch is not the only method described in the WSDL file. There also are other methods, such as working with Google's cached pages and checking the spelling of individual words. When Web services were first unveiled to the public, a common example was that a word processor would now be able to call a remote Web service for spell-checking, rather than coming with a built-in system. That day is still far off in the future, but you can imagine using Google's API for an experimental version of such a service.

Moreover, we can use these outputs as inputs into another Web service call, either locally or remotely. Combining data from multiple sites is an increasingly popular thing to do, especially when combined with Google's maps API. It's amazing to see what can happen when you combine services in this way—something that we will explore in the coming months.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Google won't give me the key and code for web page : Google maps

Derry Adams's picture

Google maps are terribly inaccurate.

Google DO NOT provide :
Advanced Geocoding
Option for Large Static Maps

service Level Agreement
Technical Support
Support portal & usage reporting

Google maps for business is a basic mapping service for API and is not always free. The customisation is poor, and the coverage is not great, seldom recognising small towns and only to postcode accuracy as NO geocoding !

If something is good enough, they would not give it away !

i prefer a Viamichelin solution, much more professional

Nick Wood's picture

Just had this back from a business who has moved to Google to ViaMichelin !

Initially Simplytrax used a product I trialed and it stank (2008) and I told them I can only assume that this is a joke.

They have sinced changed provider and told me that Google maps are terrible unlike our new system with benefits from enhanced ViaMichelin technology.
Google maps web service is about the worst mapping I have seen and I have seen most mapping systems. No reputable company would use Google API.

Our new platform uses a viamichelin business web service which far surpasses anything we have seen before.

More coverage, better accuracy and support and a world recognised brand for quality for a price less than I thought ( ViaMichelin were Cheaper than the Google enterprise Ajax API we solution by 25% with straight forward Javascript coding !

Mark Boardman of ViaMichelin business UK stated " We are pleased to have secured this contract to ensure the continued success of SimplyTrax"

Nick

Simply Trax

Google won't give me the key and code for web page

arlequin's picture

Dear Reuven,
Congratulations for your article!

I've registered a Google account this morning but still haven't received an email with the file... Is it normal this way?

I'd like to use your perl script embedded into a web page but I work with PHP. Is there a simple way to put that perl code to work on a web page assuming the parameters came from a form?
I assume PHP 4 manages SOAP, can I work with PHP/SOAP?

Thanks

Gabriel Menini
Linux Registered User #207262

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState