20
Project: web service composition Jianguo Lu University of Windsor

Project: web service composition Jianguo Lu University of Windsor

Embed Size (px)

Citation preview

Page 1: Project: web service composition Jianguo Lu University of Windsor

Project: web service composition

Jianguo Lu University of Windsor

Page 2: Project: web service composition Jianguo Lu University of Windsor

2

Search for web services

• Xmethods …• Google search, yahoo, …• Web service examples

– Amazon, Barnes Noble– Google, Yahoo– Ebay– Alexa: web site traffic ranking– Web site promotion service– Weather– Yellow page, zipcode look up– Currency converters– Amortization calculation, mortgage – Stock quote– SMS, email, fax sender– Yellow page– Mappoint

Page 3: Project: web service composition Jianguo Lu University of Windsor

3

Useful links

– Links to web services and projects • http://serl.cs.colorado.edu/~dennis/cs7818f06/links.html

Page 4: Project: web service composition Jianguo Lu University of Windsor

4

Service composition examples

• Meta search engines– Combine google and yahoo (or amazon?)

• Display amazon product prices in currencies other than USD.– Combine currency converter with amazon (or ebay)

• Compare prices from ebay and amazon

• … …

Page 5: Project: web service composition Jianguo Lu University of Windsor

5

A few books on Amazon, Yahoo, Ebay APIs

• Be aware that information may be outdated

• For example, google not issuing new access IDs

Page 6: Project: web service composition Jianguo Lu University of Windsor

6

Amazon

• Amazon E_Commerce Service• Alexa Web Information Service (AWIS)• Amazon Simple Queue Service

• Amazon E_Commerce Service– Retrieving product and pricing information– Retrieving customer reviews of a product– Retrieving product images– Performing simple and advanced searches– Retrieving wish lists by name, e-mail, and other identifiers– Creating and updating remote shopping carts

• Alexa Web Information Service (AWIS)– Performing Web searches– Accessing Web pages by categories and subcategories– Accessing Web site statistics gathered from Alexa’s Web crawls– Accessing Web page metadata gathered from Alexa’s Web crawls– Retrieving links to or from a specified URL

Page 7: Project: web service composition Jianguo Lu University of Windsor

7

• Amazon Simple Queue Service

– It offers a hosted queue for buffering messages between distributed application components.

– It enables you to decouple components of your application so that they run independently. Any component of a distributed application can store any type of data in a reliable queue at Amazon.com.

– Once the component is stored in the queue, any other procedure or application can then later retrieve the data. A single queue can be used simultaneously by multiple applications or components without the need for them to communicate with each other.

– What is terrific about this new Simple Queue Service API is that your application does not have to be based on other Amazon.com features in any fashion for you to take advantage of it.

Page 8: Project: web service composition Jianguo Lu University of Windsor

8

ECS operations

• Item lookuphttp://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription ID]

&Operation=ItemLookup

&ItemId=[Up to 10 ID’s separated by commas, assumed to be ASIN unless temType

parameter used]

• ItemSearch: search for products or restaurants.http://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription ID Here]

&Operation=ItemSearch&Keywords=[Keywords]

&SearchIndex=[Search Index]

• REST web service

Page 9: Project: web service composition Jianguo Lu University of Windsor

9

Executing a Query Using HTTP-GET (REST)

• You can test the web service in browsershttp://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription Id Goes Here]

&Operation=ItemSearch

&SearchIndex=Books

&Keywords=Amazon%20MapPoint%20API

Page 10: Project: web service composition Jianguo Lu University of Windsor

10

• You can send the request out using a program– For example, in .NET, you can use the System.Net.WebRequest

object to perform the HTTP-GET, – and then use the System.Xml.XmlTextReader object to parse

the results.

Page 11: Project: web service composition Jianguo Lu University of Windsor

11

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _System.EventArgs) Handles Button1.ClickDim oReq As System.Net.HttpWebRequestDim oResp As System.Net.HttpWebResponseoReq = _System.Net.HttpWebRequest.Create(“http://webservices.amazon.com/onca/xml?

Service=AWSECommerceService&SubscriptionId=[Your Subscription IDHere]&Operation=ItemSearch&SearchIndex=Books&Keywords=Amazon

%20MapPoint%20API”)‘use the StreamReader to get the responseoResp = oReq.GetResponseDim sr As New System.IO.StreamReader(oResp.GetResponseStream)Dim strResponse As String‘read the entire stream to retrieve the resultsstrResponse = sr.ReadToEnd‘write the results to the web browserResponse.Write(strResponse)End Sub

Page 12: Project: web service composition Jianguo Lu University of Windsor

12

Page 13: Project: web service composition Jianguo Lu University of Windsor

13

Other operations

• CustomerContentLookup– retrieves information submitted by customers that is available to

the public, such as reviews, wish lists, and so on.http://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription ID Here]

&Operation=CustomerContentLookup

&CustomerId=[The Customer Id you want to look up]

• CustomerContentSearch– look up the Customer ID for the person you specify by name or

e-mail address.http://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription ID Here]

&Operation=CustomerContentSearch

&Name=[name of person – such as Denise%20Gosnell]

Page 14: Project: web service composition Jianguo Lu University of Windsor

14

• Seller Lookup Operation– retrieve feedback about specific sellers, such as location,

customer feedback, average ratings, and so on.http://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription ID Here]

&Operation=SellerLookup

&SellerId=[Seller ID’s separated by commas]

Page 15: Project: web service composition Jianguo Lu University of Windsor

15

• Retrieve Product Pricing with ECS– retrieves pricing of Sony’s new LCD using the ItemSearch

method of the ECS Web API.http://webservices.amazon.com/onca/xml?Service=AWSECommerceService

&SubscriptionId=[Your Subscription Id Here]

&Operation=ItemSearch

&SearchIndex=Electronics

&Manufacturer=Sony

&Keywords=LCD

&Condition=New

&MerchantId=All

&ResponseGroup=Medium,OfferFull

Page 16: Project: web service composition Jianguo Lu University of Windsor

16

• Look Up a Friend or Family Member’s Wish List with ECS– use the wish list feature in the ECS Web API to look up a friend or family

member’s wish list so that you can purchase an item from their list. The following example looks up and retrieves a wish list using the ListSearch and ListLookup methods of the ECS Web API.

• The first step is to look up the wish list of a person by his name, e-mail address, and so on. The example that follows looks up a person by name.

http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&SubscriptionId=[Your Subscription Id Here]&Operation=ListSearch&ListType=WishList&Name=Denise%20Gosnell

• Next, you can use the list ID that is returned in the previous search to retrieve the list content.

http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&SubscriptionId=[Your Subscription Id Here]&Operation=ListLookup&ListType=WishList&ListId= YQLZOK4N6RZ5&ResponseGroup=Request,ListFull

Page 17: Project: web service composition Jianguo Lu University of Windsor

17

• Retrieve URL Information with Alexa Web Information Service– uses the UrlInfo operation of the AWIS Web API to retrieve links

of Web pages that are related to the www.amazon.com Web site.

http://aws-beta.amazon.com/onca/xml?Service=AlexaWebInfoService

&Operation=UrlInfo

&SubscriptionId=[Your Subscription ID]

&Url=www.amazon.com

&ResponseGroup=RelatedLinks

Page 18: Project: web service composition Jianguo Lu University of Windsor

18

Other ways to use Amazon web service

• Amazon ECS Web API:– Retrieve cover art for albums– Make recommendations for other products a customer should

consider– Retrieve additional data about a product based on a partial

match (ISBN based on title, and so on)– Analyze sales data from Amazon purchases for product

development research

Page 19: Project: web service composition Jianguo Lu University of Windsor

19

• Here are examples of other ways to use the Alexa Web Information Service:– Analyze your Web site’s statistics– Analyze the Web site statistics of your competitors to help point

you to the companies you should be looking at– Find out if someone is improperly linking and/or framing to your

Web site. Such a feature might be useful for attorneys and companies trying to track down infringers of intellectual property.

Page 20: Project: web service composition Jianguo Lu University of Windsor

20

• Here are some creative examples of ways you might use the Simple Queue Service:– Create an application that allows users to submit requests to the

queue and then check the queue periodically to perform the requested action (for example: search Google with specified criteria contained in the message in the queue).

– Use the queue as a bulletin board of sorts with an application that reads the queue to allow multiple people to share information with each other (for example: a to-do list, project information, and so on).

– Use the queue to store a simple list of information you want to access from anywhere (for example: list of favorites, personal information that is not sensitive, and so on). You can then use HTTP/GET (REST) for the particular URL to retrieve the list from a Web browser from any computer in the world with an Internet connection.