180 likes | 315 Views
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). 商業邏輯元件與前端視覺元件在一起,延展性與負載性不佳。. Servers Data, Hosts.
E N D
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) • 商業邏輯元件與前端視覺元件在一起,延展性與負載性不佳。 Servers Data, Hosts UI Logic Biz Logic Browsers OS Services
Distribution Environment (2) • 商業邏輯與前端視覺元件分開,增加了延展性,同時也較易於維護。 Biz Logic Tier Servers Data, Hosts Rich Client UI Logic 分散式元件 Richer Browsers 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 防火牆 Servers Data, Hosts Rich Client UI Logic 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 SOAPDiscovery • 描述 web site 所提供的 Web Services SOAPContract Language • Web Services 所定義的格式與訊息順序 SOAP • Web Service Provider and Consumers 之間利用 XML 送、收訊息 XML, XSDHTTP, SMTP • 所有的這些性能都建立再使用開放的 Internet protocols
http://yourservice.com HTML or XML with link to SCL SCL http://yourservice.com/SCL XML with service descriptions http://yourservice.com/svc1 XML/SOAP BODY Web Service Web Service Consumer Web Service Provider Discovery SOAP Runtime Design-Time or Dynamic
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 Message SOAP Message 標準的 Protocol (HTTP, SMTP, etc.)與 SOAP Headers <Envelope> encloses payload SOAP Envelope SOAP Header <Header> encloses headers SOAP Body <Body> 包含 SOAP 訊息名稱與資料 XML 編碼的 SOAP 訊息名稱與資料 SOAP Format Protocol Headers Headers Message Name & Data
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
Web Service Consumer 正則語言樣本字串 [0-9]* 與來源字串 ABCDE 作比對,傳回結果成功,因為空字串也符合樣本字串。 本程式叫用先前 http://www.johnaxer.idv.tw /example 的 Web Service