Web Services

Download Report

Transcript Web Services

雲端程式設計介紹
Chang Chi-Chung
2011.05.10
Cloud Computing
雲端服務
Cloud
Computing
Services
Gartner
不是人
名喔
雲端技術
Cloud
Computing
Technologies
Gartner 對於 Cloud Computing 的分類方式
雲端運算何以成真?
Representational State Tranfer
Service-Oriented Architecture
Virtualization
Web Service
WSDL
Distributed Computing
Grid Computing
UDDI
Cluster Computing
SOAP
XML
Computing Roadmap
Distributed Computing:
Grid
(Globus -> OGSA)
Cloud
Computing ???
Applications:
Web Services
(SOAP, WSDL, UDDI)
Operating System:
Linux
Information:
World-wide Web
(html, http, j2ee, xml)
Communications:
e-mail
(pop3,SMTP,Mime)
Networking:
The Internet
HPC Lab., CSIE, Tunghai U.
(TCP/IP)
4
Web Services
使用 HTTP 協定,可穿越防火牆
通訊的內容為 XML 格式文件,
程式化存取網站的服務
允許豐富的、動態的通訊於應用程式間
Components for the Web
Web 防火牆
Services
Rich Client
UI Logic
Servers
Data, Hosts
Web Service
XML、SOAP、HTTP
Richer
Browsers
OS Service
XML、SOAP、HTTP
Web Service
Web Service Consumer
正則語言樣本字串 [0-9]* 與來源字
串 ABCDE 作比對,傳回結果成功,
因為空字串也符合樣本字串。
本程式叫用先前 http://www.johnaxer.idv.tw /example 的 Web Service
REST
REST (Representational State Transfer),西元
2000年由Roy Fielding 在其博士論文中提出。
是一種設計風格而不是標準。
資源是由 URI 來指定,並利用 HTTP 1.1 所
定義方法 POST、GET、PUT、和 DELETE
來操作資源,對應於 CRUD。
使用HTTP並遵循 REST 原則的Web服務,
稱作 RESTful。
REST Examples
列舉所有文件
GET http://www.johnaxer.idv.tw/docs
取得某一份文件
GET http://www.johnaxer.idv.tw/docs/8
刪除某一份文件
DELETE http://www.johnaxer.idv.tw/docs/8
新增一份文件
POST http://www.johnaxer.idv.tw/docs
<documents>
<content> ... </content>
</documents>
Grid Computing (1)
這些資源唾手可得,具體展現了虛擬化(Virtualization) 的概念。
把有用的功能隱
藏在界面之後,
以掩蓋住功能運
作方式的細節。
Grid Computing (2)
Grid Computing (3)
Grid Computing(4)
http://www.twgrid.org/
雲端服務主要類型
 儲存即服務 (Storage as a Service)
 提供使用者儲存空間
 Dropbox、Windows Skylive
 軟體即服務 (Software as a Service, SaaS)
 提供使用者網路的軟體應用。
 Yahoo電子信箱、Google地圖、Youtube、Facebook、趨勢科技的雲端防毒。
 平台即服務 (Platform as a Service, PaaS)
 建置平台以提供運算或解決方案,並提供了整合的API(應用程式介面),可以讓客戶的應
用程式放在該平台代管,佈署更簡便,而且節省成本。
 微軟的Windows Azure、Google的 App Engine、Yahoo的 Application Platform。
 基礎設施即服務 (Infrastructure as a Service, IaaS)
 直接提供硬體的環境及網路頻寬給用戶使用,
 中華電信的HiCloud、IBM的Blue Cloud、HP的Flexible Computing Services及亞馬遜的
EC2。
雲端運算的優點
高可用性 (High Availability)
可用性指得是系統或服務可以使用的時間,通
常以百分比表示,百分比越高,表示系統或服
務可以使用的時間越長。
高延展性 (High Scalability)
延展性或稱擴展性,指系統或服務可以依需求,
增加或減少服務量。
高可靠性 (High Reliability)
可靠度指得是系統或服務,平均無故障的時間
長短,可靠度越高,平均無故障時間就越長。
雲有幾多種?
公有雲
私有雲
Amazon的雲端運算
Amazon WebService (亞馬遜網路服務,簡稱
AWS)
S3 (SimpleStorageService,簡單儲存服務)
EC2 (Elastic ComputeCloud,彈性雲端運算)
SQS (SimpleQueuingService,簡單訊息佇列服務)
VPC(Virtual Private Cloud,虛擬私有雲)
SimpleDB…等。
Amazon WebService
http://aws.amazon.com/free/
介紹網址:http://blog.soft.idv.tw/?p=823
雲端程式設計
 Microsoft Windows Azure
 Visual Studio 2010
 Windows Azure Tools for Microsoft Visual Studio
 Windows Azure Account
 C#、PHP、VB.Net…
 Google App Engine
 Eclipse and Plugins
 Google App Engine SDK
 Google Account
 Python、Java
三螢一雲
Microsoft Azure at Chicago
Microsoft Cloud Computing
Windows Azure Platform 概觀
Windows Azure Platform
Windows Azure Platform Architecture
Windows Azure 作業系統
計算能力服務 (Compute Service)
儲存體服務 (Storage Service)
Fabric 服務 (Fabric Service)
Windows Azure Storage
 提供四種資料儲存型態
 Blobs: 二進制資料 (Binary Data)
 Tables: Entity-based Storage (並非關聯式資料庫模型)
 Queues: 以訊息為基礎之通訊方式
 Drives : 提供虛擬磁碟功能,支援檔案系統 (NTFS API)
 存取方式
 僅可透過 REST 為存取界面
 資料可提供
Windows Azure 應用程式使用
其他 on-premises 應用程式使用
Programming in Visual Studio(1)
點選後,即可自動安裝
Windows Azure Tools
Express 的版本,請使用
Visual Web Developer 2010 Express
Programming in Visual Studio (2)
WebRole 需要UI的程式
WokerRole 類似Windows Service
目前依據 Microsoft 的規定,雲端程式一但佈署到
Windows Azure Platform 上,即開始計費。
Google App Engine
Python
Java
http://code.google.com/intl/zh-TW/appengine/docs/whatisgoogleappengine.html
DEMO