|
Laboratory Week 11 - Web Service Demonstration
Learning Objectives:
- Appreciate the basic steps involved in invoking a Web Service using Perl, using an API provided by the Google search engine.
Required Reading:
Lectures: Week 10 lectures.
Access to Software:
All required software is available on gryphon.murdoch.edu.au. Students wishing to get access to the full set of software may also follow the instructions for Google Web API at http://www.google.com.au/apis/.
Instructions:
The following instructions make use of files available in the unit coordinator's directory (~hiew/examples/googleapi/) on gryphon. Use the command "cp" to copy the file over to your work directory on gryphon. Eg.
gryphon:~> mkdir ~/labwk10
gryphon:~> cp ~hiew/examples/googleapi/* ~/labwk10Go to the Google Web API page and click on "Create a Google Account". Follow the instructions to create yourself an account and get a key to use the Google Web Service.
Edit the googlesearch.pl script. Replace the string '0xx0' in line 11 with the key you obtained from step (2).
- The googlesearch.pl script uses the google search engine to retrieve some results for a keyword search. Try the script by supplying two parameters: the first is the query keyword, and the second is the number of results to return. Eg.
perl googlesearch.pl Internet 5
perl googlesearch.pl "XML Resources" 3Look at the GoogleSearch.wsdl file. Find the equivalent elements in that file that is used in the googlesearch.pl script (eg. estimatedTotalResultsCount and URL in resultElements).
Exercises:
(To test you followed the instructions above properly) Use googlesearch.pl to retrieve the top 5 results for a search on the keyword 'php'.
Think about using this way of getting Google search results. What are the advantages as a software developer compared to the ways of using Google before?
Think about using this way of supplying the Google search facility (ie. think of yourself as developing for the Google search engine). What are the advantages as a software developer compared to the ways of supplying Google before?
Modify the googlesearch.pl script so that it shows the following:
The original search query string received by the service.
The title of the URL's retrieved.
Any relevant Google Directory titles of the retrieved results.
Assessable Tasks:
Exercises 1-3.
Internal students should discus the answers with your tutor by executing your scripts with your tutor present. Exercises 1-3 must be demonstrated on or before week 9, and exercise 4-6 must be done on or before week 10. No marks will be awarded if the work is demonstrated after that - your tutor have no discretionary power on this deadline.
External students should submit the scripts and sample runs as Assignment 3.
Note:
This lab is not meant to prepare you for full development work in SOAP or Web Services. There is insufficient time to do so. It is only Those of you interested in doing Web Service programming should first start doing research on a lot more details of SOAP,WSDL and UDDI before proceeding with dealing with programming details.
H.L. Hiew
Unit Coordinator
Document author: H.L.
Hiew, Unit Coordinator
Last Modified: Sunday, 11-May-2003 18:42:39 MST
Disclaimer & Copyright
Notice © 2003 Murdoch University
This document is relevant for semester 1, 2003 only