Web Service 實作簡介
Download
Report
Transcript Web Service 實作簡介
Web Service 實作簡介
張啟中
Outline
Introduction to Web Service
Demo (An Example)
Demo (Building a Web Service with .Net)
Demo (Consuming a Web Service with .Net)
Programming Model
View
Model
Control
Distribution Environment (1)
商業邏輯元件與前端視覺元件在一起,延展性
與負載性不佳。
UI Logic
Biz Logic
Browsers
OS
Services
Servers
Data, Hosts
Distribution Environment (2)
商業邏輯與前端視覺元件分開,增加了延展性,
同時也較易於維護。
Rich Client
UI Logic
Richer
Browsers
Biz Logic
Tier
Servers
Data, Hosts
分散式元件
OS
Services
“Stateful”
“Stateless” &
“Geo-Scalable”
Distribution Objects
DCOM、COM+
EJB
ORG (CORBA)
Issue of Distribution Objects
Server 與 Client 都需要瞭解:
必須有相同的平台環境
Implementation 的細節
服務的部署
安全類型與信任關係
Binary code 相容
COM 對 COM, EJB 對 EJB, ORB 對 ORB, HTML
3.2, 等等
無法穿越防火牆
Web Services
防火牆
Rich Client
UI Logic
Servers
Data, Hosts
Web Service
XML、SOAP、HTTP
Richer
Browsers
OS Service
XML、SOAP、HTTP
Web Services
使用 HTTP 協定,可穿越防火牆
通訊的內容為 XML 格式文件,
程式化存取網站的服務
允許豐富的、動態的通訊於應用程式間
Components for the Web
Web Service Technology
XML
SOAP
HTTP or HTTPS
描述 web site 所提供的 Web Services
Web Services 所定義的格式與訊息順序
Web Service Provider and Consumers
之間利用 XML 送、收訊息
所有的這些性能都建立再使用開放的
Internet protocols
SOAP
Discovery
SOAP
Contract Language
SOAP
XML, XSD
HTTP, SMTP
Web Service
Discovery
http://yourservice.com
HTML or XML with link to SCL
SCL
Web
Service
Consumer
http://yourservice.com/SCL
XML with service descriptions
Web
Service
Provider
SOAP
http://yourservice.com/svc1
XML/SOAP BODY
Design-Time or Dynamic
Runtime
SOAP
Simple Object Access Protocol
Lightweight XML-based messaging format
Application
Any operating system
Any programming language
Any platform
Builds on
W3C XML standards
SOAP Format
Protocol Headers
整個 SOAP Message
標準的 Protocol (HTTP, SMTP, etc.)
與 SOAP Headers
SOAP Envelope
<Envelope> encloses payload
SOAP Message
SOAP Header
<Header> encloses headers
Headers
SOAP Body
Message Name & Data
<Body> 包含 SOAP
訊息名稱與資料
XML 編碼的 SOAP
訊息名稱與資料
Microsoft .Net with Web Service
Visual Studio .NET 2002/2003
Visual Studio 6 請下載 Web Service SDK
Tools 安裝即可。
.Net Build on XML,對於 Web Service 支援
相當豐富。
Windows 2003 內建 UDDI Server
Example
Web Service Provider
Web Service Consumer
正則語言樣本字串 [0-9]* 與來源字
串 ABCDE 作比對,傳回結果成功,
因為空字串也符合樣本字串。
本程式叫用先前 http://www.johnaxer.idv.tw /example 的 Web Service
DEMO