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) 商業邏輯元件與前端視覺元件在一起,延展性 與負載性不佳。 OS Services Browsers Servers Data, Hosts UI Logic Biz Logic
Distribution Environment (2) 商業邏輯與前端視覺元件分開,增加了延展性, 同時也較易於維護。 OS Services Biz Logic Tier Rich Client UI Logic Servers Data, Hosts Richer Browsers “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 OS Service Web Service Rich Client UI Logic Servers Data, Hosts Richer Browsers XML 、 SOAP 、 HTTP 防火牆
Web Services 使用 HTTP 協定,可穿越防火牆 通訊的內容為 XML 格式文件, 程式化存取網站的服務 允許豐富的、動態的通訊於應用程式間 Components for the Web
Web Service Technology XML SOAP HTTP or HTTPS SOAP Web Service Provider and Consumers 之間利用 XML 送、收訊息 SOAP Contract Language Web Services 所定義的格式與訊息順序 SOAP Discovery 描述 web site 所提供的 Web Services 所有的這些性能都建立再使用開放的 Internet protocols XML, XSD HTTP, SMTP
WebServiceConsumer Web Service Provider Web Service Discovery SCL SOAP Design-Time or Dynamic Runtime HTML or XML with link to SCL XML with service descriptions XML/SOAP BODY
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 SOAP Message SOAP Envelope SOAP Header SOAP Body Message Name & Data Headers Protocol Headers XML 編碼的 SOAP 訊息名稱與資料 包含 SOAP 訊息名稱與資料 encloses headers encloses payload 標準的 Protocol (HTTP, SMTP, etc.) 與 SOAP Headers 整個 SOAP Message
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 作比對,傳回結果成功, 因為空字串也符合樣本字串。 本程式叫用先前 /example 的 Web Service
DEMO