Transcript 2 age (1)
Programming with Amazon,
Google, and eBay
Chunju Tseng (Lu)
[email protected]
http://www.u.arizona.edu/~chunju/age.ppt
Outline
9/13 (Tuesday)
Web Services in a nutshell
Overview of Amazon, Google, and eBay APIs
Lab Session: Web Services Programming
9/15 (Thursday)
Back to World Wide Web 101
Lab Session: Java Web Programming
What is Web Services?
Web Services:
A new way of reuse/integrate third party softwre
or legacy system
No matter where the software is, what platform
it residents, or which language it was written in
Based on XML and Internet protocols (HTTP,
SMTP…)
Benefits:
Ease of integration
Develop applications faster
Web Services Architecture
Simple Object Access Protocol (SOAP)
Web Service Description Language
(WSDL)
Universal Description, Discovery and
Integration (UDDI)
New Breeds of Web Services
Representational State Transfer (REST)
Use HTTP Get method to invoke remote services (not
XML)
The response of remote service can be in XML or any
textual format
Benefits:
Easy to develop
Easy to debug (with standard browser)
Leverage existing web application infrastructure
We will focus on REST services programming in the lab
session
Really Simple Syndication (RSS)
Designed for news-oriented websites to “Push” content
to readers
Excellent to monitor new content from websites
Amazon Web Services (AWS)
Amazon E-Commerce Service
Search catalog, retrieve product information,
images and customer reviews
Retrieve wish list, wedding registry…
Search seller and offer
Alexa Web Information Service
Retrieve information such as page rank, related
sites given a target URL
Amazon Simple Queue Service
A distributed resource manager to store web
services results
Google Web APIs
Programmatically search web pages
using Google
Get information about search result
including URL, snippet, title and
directory category
Spell-checking and suggestion
eBay API
Buyers:
Get the current list of eBay categories
View information about items listed on eBay
Display eBay listings on other sites
Leave feedback about other users at the
conclusion of a commerce transaction
Sellers:
Submit items for listing on eBay
Get high bidder information for items you are
selling
Retrieve lists of items a particular user is
currently selling through eBay
Retrieve lists of items a particular user has bid
on
Other Free Web Services
Google Maps API
http://www.google.com/apis/maps/
Crime mapping: http://www.chicagocrime.org/
Fine cheap gas: http://www.mywikimap.com/
http://www.microsite.reuters.com/rss/topNews
http://techbargains.com/rss.xml
http://beta.search.msn.com/results.aspx?q=FMD&format=rss
http://rss.news.yahoo.com/rss/highestrated
http://news.search.yahoo.com/news/rss?p=YHOO
http://www.rssweather.com/
http://xmethods.com/
Reuters News
Shopping Deals
MSN Search Engine
Yahoo Highest-rated News
Yahoo Financial News Search
World Weather RSS Feed
XMethods.net
Lab Session:
Amazon, Google, EBay APIs
Required Software:
NetBeans IDE
Amazon API
(http://www.amazon.com/gp/aws/landing.html)
Google API
(http://www.google.com/apis/)
Registered with Amazon and
Google
Topics:
Setup NetBeans
Execute Amazon Samples
REST with Browser
REST with Jakarta HttpClient
Programming Google API
Setup NetBeans with Amazon
Assume NetBeans 4.1 is installed
http://www.netbeans.org/
Register Amazon subscription ID
http://www.amazon.com/gp/aws/landing.html
Download Amazon Java sample
Create NetBeans project
Install necessary libraries
Execute Amazon code sample
Main.java
Retrieve Customer Information
CustomerContentSearch
Give name to retrieve customer ID
CustomerContentLookup
Give customer ID
Request WishList information
ResponseGroup=CustomerInfo,
CustomerLists
Receive WishList ID
Use Amazon API Reference!!
Retrieve Customer WishList and
Response Manipulation
ListLookup
Give list ID and type to retrieve WishList content with
a simple browser (REST)
ResponseGroup=ListItems,ListInfo
Result shows in XML format
ListLookup with xml-to-text XSLT
Give custom XSL to manipulate response
Style=http://www.u.arizona.edu/~chunju/text.xsl&C
ontentType=text/plain
ListLookup with xml-to-html XSLT
ResponseGroup=ListItems,ListInfo,Images,SalesRank
,ItemAttributes
Style=http://www.u.arizona.edu/~chunju/html.xsl&C
ontentType=text/html
Access Amazon REST Service with
Jakarta HttpClient
Download & install necessary libraries
Jakarta HttpClient, Codec
JUnit
Write first Java program in NetBeans
Use previous REST invocation strings
Print Amazon response in console
Resources:
http://jakarta.apache.org/commons/index.html
http://www.junit.org/
http://www.u.arizona.edu/~chunju/HttpClientMa
in.java
Programming Google API
Download Google Web API
http://www.google.com/apis/
Install Google library
Execute Google API demo
Write Java codes to search Google
Search Google
Access cached pages
Keyword suggestion
Source:http://www.u.arizona.edu/~chunju/Goog
leMain.java
Other Resources
Java Web Services Developer Pack
http://java.sun.com/webservices/downloads/we
bservicespack.html
Consuming Web Services with NetBeans
http://www.javapassion.com/planning/handsonb
yol/netbeanswebservices/
XSLT Tutorial
http://www.w3schools.com/xsl/
Lab Session Step-by-step Snapshots
http://www.u.arizona.edu/~chunju/mis531a/
See you next time!
Questions are welcome
World Wide Web 101
Flash/
Applets
Plug-ins
JavaScript
VBScript
HTML/
CSS
ASP, JSP, PHP…
Script
Renderer
Engine
Application Server
Browser
Web Server
HTTP
request
response (HTML)
Static Web Pages
Browser
Internet Explorer, Mozilla Firefox,
Netscape
Web Server
Apache, IIS
HTML
Hypertext Markup Language
HTTP
Hypertext Transfer Protocol
Dynamic Web Pages
Application Servers
Tomcat, IIS, mod_php
Server side programming languages
ASP, JSP, PHP, cgi, ….. ROR
Client side programming languages
JavaScript, VBScript
Dynamic HTML, XHTML, CSS
Other dynamic contents
Java Applets, ActiveX, Flash
Rich Interactivity Web - AJAX
AJAX: Asynchronous JavaScript + XML
AJAX incorporates:
standards-based presentation using XHTML and CSS;
dynamic display and interaction using the Document Object
Model;
data interchange and manipulation using XML and XSLT;
asynchronous data retrieval using XMLHttpRequest;
and JavaScript binding everything together.
Examples:
http://www.gmail.com
http://www.kiko.com
More info:
http://www.adaptivepath.com/publications/essays/archives/000385.php
AJAX Application Model
Lab Session:
Java Web Programming
Required Software:
JDK 1.4 or later
Apache Tomcat
NetBeans IDE (optional)
Topics:
Install JDK
Install Tomcat
First Java Server Page
Servlet with NetBeans IDE