Presentation is loading. Please wait.

Presentation is loading. Please wait.

Google’s Web Service January 4, 2004 Shuying Wang.

Similar presentations


Presentation on theme: "Google’s Web Service January 4, 2004 Shuying Wang."— Presentation transcript:

1 Google’s Web Service January 4, 2004 Shuying Wang

2 Overview An introduction to Web Service –SOAP & WSDL Google’s Web Service Architecture Google Web API Google Web API application

3 Web Evolution XML ProgrammableWeb Static Web DHTML JSP ASP… Dynamic Web HTML Technology Innovation Web Pages Alternate Web Pages Browse the Web Program the Web Web Services

4 What Is A Web Service? This is the official W3C take on a Web service definition: “A Web service is a software system designed to support interoperable machine-to- machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP- messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web- related standards. ”

5 Architecture of Web Service

6 Simple Object Access Protocol – SOAP 1.2 Generic XML-based RPC protocol Initial specification only covers HTTP- binding Use of XML Schema Multiple protocol bindings available today(SMTP, FTP, JMS, etc.) RPC-style and document-style communication

7 Example SOAP Message Request A standard XML-based format to describe a SOAP request for a Web Service Provides all the information required by the Web Service provider to process the request General format of a SOAP request: HTTP Header SOAP Action

8 Example SOAP Message Reponse A standard XML-based format to describe the Response generated by a Web Service Contains information that is to be passed back to the client General format of a SOAP response: HTTP Header

9 Web Service Definition Language-WSDL(1) From the spec: “XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.” In another word, WSDL is XML Based Language for describing web services and how to access them

10 Web Service Definition Language-WSDL(2) WSDL describes four pieces of critical data: Interface information describing all publicly available functions Data type declarations for all message requests and responses Binding information about the transport protocol Address information for locating the service

11 Web Service at Google In 2002 Google and Amazon introduced Web services APIs SOAP API for accessing Google –Requires registration for a developer’s license key –Limit of 1000 queries per day –According to license terms only way to access Google programmatically

12 Google Web Service Architecture

13 Google API Language Support Google.com Google API.NET Java Perl c PHP Web Service client Web Service client Web Service client Web Service client Web Service client SOAP request SOAP request SOAP request SOAP response SOAP response SOAP response

14 The Google Web APIs Developer’s Kit http://www.google.com/apis/download.html –A cross-platform WSDL file –A Java wrapper library –A sample.NET application –Documentation, including JavaDoc and SOAP XML samples

15 Google Web API Beta version supports 3 types of queries: –doSearch –doGetCachedPage –doSpellingSuggestion.

16 Understanding the Google API query The command in a typical Perl-based Google API applicaton that sends a query to Google looks like: $results = $google_search-> doGoogleSearch(key, query, start, maxResults, filter, restrict, safeSearch, lr, ie, oe);

17 A sample $results = $google_search-> doGoogleSearch(“12BucK13mY5hoE/34KN0cK@ttH3Do0R”, “+music +mp3”,100, 10, “true”, “”, “true”, “”, “utf8”, “utf8”);

18 Google API response Can Do –Site –Daterange –Intitie –Inurl –Allintext –Allinlinks –Filetype –Info –Link –Related –Cache Can’t Do –phonebook –rphonebook –bphonebook –stocks

19 Programming the Google Web API with Java import com.google.soap.search.*; import java.io.*; public class Googly { private static String googleKey = "insert key here"; public static void main(String[] args) { GoogleSearch s = new GoogleSearch( ); // Create a new GoogleSearch object try { s.setKey(googleKey); s.setQueryString(args[0]); // Google query from the command-line s.setMaxResults(10); GoogleSearchResult r = s.doSearch( ); // Query Google GoogleSearchResultElement[] re = r.getResultElements( ); // Gather the results for ( int i = 0; i < re.length; i++ ) { // Output System.out.println(re[i].getTitle( )); System.out.println(re[i].getURL( )); System.out.println(re[i].getSnippet( ) + "\n"); } } catch (GoogleSearchFault f) { System.out.println("GoogleSearchFault: " + f.toString( )); }

20 Google API application

21 Resources http://www.w3c.org/ http://www.google.com/apis/ “Guided Google: A Meta Search Engine and its Implementation using the Google Distributed Web Services” Ding Choon Hoong & Rajkumar Buyya “Google HACKS” Tara Calishain & Rael Dornfest


Download ppt "Google’s Web Service January 4, 2004 Shuying Wang."

Similar presentations


Ads by Google