20
Web Service 2008-4-21

Web Service

Embed Size (px)

DESCRIPTION

Web Service. 2008-4-21. 什么是 Web 服务 ? 建立可互操作的分布式应用程序的平台 能够通过 Web 进行调用的 API GET http://localhost/weather.asp?zipcode=20171 返回数据: 21, 晴 . 这个页面就可以算作是 Web service 了 . 哪些服务 ? Google EBay 技术手段 ? SOAP REST …. Overview. Computer. Human. Shopping Trading Research. - PowerPoint PPT Presentation

Citation preview

Page 1: Web  Service

Web Service2008-4-21

Page 2: Web  Service

Overview

什么是Web服务 ?◦建立可互操作的分布式应用程序的平台◦能够通过Web进行调用的 API

GET http://localhost/weather.asp?zipcode=20171 返回数据: 21,晴 . 这个页面就可以算作是Web service 了 .

哪些服务 ?◦Google◦EBay

技术手段 ?◦SOAP◦REST◦…

Page 3: Web  Service

Shopping

Trading

Research

Computer Human

EBay 服务提供商提供了哪些服务 ?

Page 4: Web  Service

EBay 服务使用者如何使用这些服务 ?

Get a list with keyword “T-shirt”|Search and browse|Shopping web service|Document or WSDL|XML/JSON/SOAP|Parse or use Toolkit

XML Sample

Page 5: Web  Service

XML

Page 6: Web  Service

JSON(JavaScript Object Notation)

轻量级 ,介于 TEXT和 XML之间不需要解析器 ,直接转为 JavaScript数组

Page 7: Web  Service

SOAP

AddOrder method

Page 8: Web  Service

EBay 服务提供商如何设计服务的架构 ?

(JSON)REST

Page 9: Web  Service

SOAP VS REST

REST(Representational State Transfer)◦ Resources(N) + POST/PUT/GET/DELETE(CURD)(V)◦资源多重表述 (JSON/XML/IMAGE)◦ REST最大的特点是容易被人理解 ,不需要额外的工具进行解析 .• 早期的web service比较常用 SOAP,目前 REST日渐流行 (Google).• Lightweight.

Including Yahoo, delicious, Amazonall provide web service usingREST style architecture.

SOAP(Simple Object Access Protocol)◦ WSDL+UDDI+WS-*◦各个平台提供支持 .• 易于设计应用级别的访问接口 .• 不依赖于 HTTP的多重协议 .

Including Google, EBayall provide web service usingSOAP.

Page 10: Web  Service

SOAP VS REST

Page 11: Web  Service

Google 服务提供商提供了哪些服务 ?

公开的有 50多种供开发者调用的服务◦ GData(Google Data API)

◦ Blogger, Calendar, Picasa, YouTube, Gmail(Atom)

◦ URL

◦ Account, Static Map, Chart

◦ AJAX

◦ Map, Search, Book Search, Checkout

◦ SOAP

◦ AdSense, AdWords

◦ XMPP

◦ GTalk

◦ Toolkit

◦ Gadget, Web Toolkit, Desktop Search, Desktop Gadget, Mashup Editor, Mapplets

REST

Page 12: Web  Service

GData

Based on Atom 1.0 and RSS 2.0 Query

Update

Collaboration

Authentication

In the spirit of REST Resource(URL)

Query->GET

Updates->POST/PUT/DELETE

Page 13: Web  Service

Google 服务使用者如何使用这些服务 ?

Refer to : http://code.google.com/apis/youtube/developers_guide_protocol.html

Get a video list(YouTube)

GET http://gdata.youtube.com/feeds/api/standardfeeds/top_ratedResponse:

Page 14: Web  Service

Google 服务使用者如何使用这些服务 ?

GET

Page 15: Web  Service

Google 服务使用者如何使用这些服务 ?

Page 16: Web  Service

Google 服务使用者如何使用这些服务 ?

Add a calendar

Response:

POST:

POST

Page 17: Web  Service

URL

Account GET https://www.google.com/accounts/ClientLogin?

accountType=HOSTED_OR_GOOGLE&[email protected]&Passwd=north23AZ&service=cl

Response SID=DQAAAGgA...7Zg8CTN LSID=DQAAAGsA...lk8BBbG Auth=DQAAAGgA...dk3fA5N

Static Map GET http://maps.google.com/staticmap?center=40.714728,-

73.998672&zoom=14&size=512x512&maptype=mobile\ &markers=40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc\ &key=MAPS_API_KEY

Response

Page 18: Web  Service

AJAX

Load Engine

Setting Map

Setting Search

Display

Page 19: Web  Service

AdSense 针对网站主的一种服务 ,将广告主投放的广告投放于网站主的网站 ,以使网站主分享广告收益

https://www.google.com/api/adsense/v3/AdSenseForContentService?wsdl

SOAP

Page 20: Web  Service

Gadget

Google Gadgets Editor+Google Gadget API

http://code.google.com/apis/gadgets/docs/gs.html#GGE