23
Programming with Amazon, Google, and eBay Chunju Tseng (Lu) [email protected] http://www.u.arizona.edu/~chunju/ age.ppt

Programming with Google, Amazon and EBay

Embed Size (px)

Citation preview

Page 1: Programming with Google, Amazon and EBay

Programming with Amazon, Google, and eBay

Chunju Tseng (Lu)[email protected]

http://www.u.arizona.edu/~chunju/age.ppt

Page 2: Programming with Google, Amazon and EBay

Outline

9/13 (Tuesday)Web Services in a nutshellOverview of Amazon, Google, and eBay APIsLab Session: Web Services Programming

9/15 (Thursday)Back to World Wide Web 101Lab Session: Java Web Programming

Page 3: Programming with Google, Amazon and EBay

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

Page 4: Programming with Google, Amazon and EBay

Web Services Architecture

Simple Object Access Protocol (SOAP) Web Service Description Language

(WSDL) Universal Description, Discovery and

Integration (UDDI)

Page 5: Programming with Google, Amazon and EBay

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

Page 6: Programming with Google, Amazon and EBay

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

Page 7: Programming with Google, Amazon and EBay

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

Page 8: Programming with Google, Amazon and EBay

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

Page 9: Programming with Google, Amazon and EBay

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/

Reuters News http://www.microsite.reuters.com/rss/topNews

Shopping Deals http://techbargains.com/rss.xml

MSN Search Engine http://beta.search.msn.com/results.aspx?q=FMD&format=rss

Yahoo Highest-rated News http://rss.news.yahoo.com/rss/highestrated

Yahoo Financial News Search http://news.search.yahoo.com/news/rss?p=YHOO

World Weather RSS Feed http://www.rssweather.com/

XMethods.net http://xmethods.com/

Page 10: Programming with Google, Amazon and EBay

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

Page 11: Programming with Google, Amazon and EBay

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

Page 12: Programming with Google, Amazon and EBay

Retrieve Customer Information CustomerContentSearch

Give name to retrieve customer ID CustomerContentLookup

Give customer ID Request WishList information ResponseGroup=CustomerInfo, CustomerLis

ts Receive WishList ID

Use Amazon API Reference!!

Page 13: Programming with Google, Amazon and EBay

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&Conten

tType=text/plain ListLookup with xml-to-html XSLT

ResponseGroup=ListItems,ListInfo,Images,SalesRank,ItemAttributes

Style=http://www.u.arizona.edu/~chunju/html.xsl&ContentType=text/html

Page 14: Programming with Google, Amazon and EBay

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/HttpClientMain.java

Page 15: Programming with Google, Amazon and EBay

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/GoogleM

ain.java

Page 16: Programming with Google, Amazon and EBay

Other Resources Java Web Services Developer Pack

http://java.sun.com/webservices/downloads/webservicespack.html

Consuming Web Services with NetBeans http://www.javapassion.com/planning/handsonbyol

/netbeanswebservices/ XSLT Tutorial

http://www.w3schools.com/xsl/ Lab Session Step-by-step Snapshots

http://www.u.arizona.edu/~chunju/mis531a/

Page 17: Programming with Google, Amazon and EBay

See you next time!

Questions are welcome

Page 18: Programming with Google, Amazon and EBay

World Wide Web 101

Web Server

Application Server

ASP, JSP, PHP…

Browser

RendererScriptEngine

Plug-ins

HTML/CSS

JavaScriptVBScript

Flash/Applets

HTTP

request response (HTML)

Page 19: Programming with Google, Amazon and EBay

Static Web Pages

Browser Internet Explorer, Mozilla Firefox, Netscape

Web Server Apache, IIS

HTML Hypertext Markup Language

HTTP Hypertext Transfer Protocol

Page 20: Programming with Google, Amazon and EBay

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

Page 21: Programming with Google, Amazon and EBay

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

Page 22: Programming with Google, Amazon and EBay

AJAX Application Model

Page 23: Programming with Google, Amazon and EBay

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