1 / 51

Web Services 系統整合技術 與開發實務

Web Services 系統整合技術 與開發實務. 黃昭棋 , Brouse brouse@webcomm.com.tw. 課 程 內 容. 為什麼我們需要 Web Services ? 什麼是 Web Services 的核心技術 ? 什麼是 Web Services 的技術前沿 ? 我可以怎麼開始建構 Web Services ? 如何實作一個 Web Services ? 以 << 一個 Web Services 架構下的投資理財管理系統 >> 為例 結論與討論. 店頭市場. HTTP. 電話市場. 網路市場.

Download Presentation

Web Services 系統整合技術 與開發實務

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Services 系統整合技術與開發實務 黃昭棋, Brouse brouse@webcomm.com.tw

  2. 課 程 內 容 • 為什麼我們需要Web Services ? • 什麼是 Web Services 的核心技術 ? • 什麼是 Web Services 的技術前沿 ? • 我可以怎麼開始建構 Web Services ? • 如何實作一個 Web Services ? 以<<一個Web Services架構下的投資理財管理系統>>為例 • 結論與討論

  3. 店頭市場 HTTP 電話市場 網路市場 創新服務的需求日益增加…………… 資料 OK 格式 ? 通信 ?

  4. 電子化政府共通作業平台 Web Services要解決什麼問題 ? ------ ”資訊孤島”

  5. Service Provider Service Provider Service Provider 為什麼使用 ? …… Web Services 降低創新服務開發總成本 Service Requester Service Provider

  6. SOAP Message HTTP Header Service Provider Service Provider Service Provider SOAP Envelop SOAP Header Headers SOAP SOAP Body Message …… 為了標準 …… 為了標準後的平台與開發工具 系統整合為什麼青睞 Web Services? 呼叫服務的成本 http 通信的成本 Service Requester Service Provider

  7. Web Services 技術架構誕生 HTML Presentation Layer SOAP Message SOAP Message SOAP Message SOAP Message <HTML> <BODY> </BODY> </HTML> Business Logic Business Logic HTTP Header HTTP Header HTTP Header HTTP Header WSDL WSDL WSDL Modular SOAP Envelop SOAP Envelop SOAP Envelop SOAP Envelop Described Composed Invoked Published Found Bound SOAP Header SOAP Header SOAP Header SOAP Header Browser getQuote( ) getQuote( ) JSP EJB EJB Headers Headers Headers Headers Service Description SOAP Router Service Registry Web Service Runtime SOAP Body SOAP Body SOAP Body SOAP Body HTTP DB Find Publish Message Message Message Message WSDL+UDDI WSDL+UDDI Service Requestor Service Provider Bind Service Description Service Internet Service Proxy Web Service Application Server

  8. <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encodingStyle="..."> <m:getQuote xmlns:m="my-ns"> <symbol> 2330 </symbol> </m:getQuote > </SOAP-ENV:Envelope> <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encodingStyle="..."> <m:getQuote xmlns:m="my-ns"> <symbol> 2330 </symbol> </m:getQuote > </SOAP-ENV:Envelope> <SOAP-ENV:Body> <m:getQuote xmlns:m="my-ns"> <symbol> 2330 </symbol> </m:getQuote > </SOAP-ENV:Body> <SOAP-ENV:Body> <ns1:getQuoteResponse> <return>42.50 </return> </ns1:getQuoteResponse> </SOAP-ENV:Body> <html> <title>奇摩股市</title> <body> <table > <tr><th>股票代號</th> <td>2330台積電</td></tr> <tr><th>成交</th> <td>45.00</td></tr> </table > </body> </html> 店頭市場 <tr><th>股票代號</th> <td>2330台積電</td></tr> <tr><th>成交</th> <td>42.50</td></tr> <?xml version="1.0" encoding="UTF-8"?> <Quote Type="台股"> <Symbol>2330</Symbol> <Name>台積電</Name> <Time>13:30</Time> <Date>91/08/23</Date> </Quote> HTTP 電話市場 網路市場 <Price>42.50</Price> Web Services 是企業能量的具體展現 資料 OK 格式 ? 通信 ?

  9. 店頭市場 加值整合市場 HTTP 電話市場 網路市場 企業核心價值--無遠弗屆的拓展 Web Services API ( ) • 核心價值如何形成服務? WSDL • 應用服務如何描述? UDDI • 應用服務如何週知? SOAP • 應用服務如何啟動? • 服務結果如何呈現? • 服務結果如何解讀?

  10. Web Services 三大技術主題 連結 流程 安全

  11. SOAP overview

  12. SOAP in a nutshell • An XML-based protocol with: • An envelope structure that contains a message • Encoding rules for data types • Rules for RPC requests and responses • Rules for exchanging messages using an underlying protocol

  13. Get Get Request Delete Header Option Trace Servlet Container Post Request Post App. Server Post GET/Requester/JSP/main.jsp HTTP/1.1 Accept:*/* Accept-Language:zh-tw Accept-Encoding:gzip, deflate User-Agent:Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) Host:localhost:84 Connection:Keep-Alive HTTP/1.1 200 OK Server:WebSphere Application Server/4.0 Content-Type:text/html;charset=Big5 Cache-Control:no-cache=“…" Expires:Thu, 01 Dec 1994 16:00:00 GMT Content-Language:zh Transfer-Encoding:chunked <Html> …</HTML> HTTP userID=1&StockID=2330 Http Request/Response ?

  14. SOAP Message Structure Application-specific message vocabulary Message SOAP envelope vocabulary SOAP Envelope • Request and Response messages • SOAP specification defines an "envelope" • Request invokes a method on a remote object • Response returns result of running the method • "envelope" wraps the message itself • message is a different vocabulary • namespace prefix is used to distinguish the two parts

  15. A SOAP Request Message Message SOAP Envelope POST /SOAP_Provider/servlet/rpcrouter HTTP/1.0 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: 500 SOAPAction: "" <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:getStockQuotexmlns:ns1="http://tempuri.org/lib.webservices.YahooStockQuote" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <strSymbol xsi:type="xsd:string">2330</strSymbol> </ns1:getStockQuote> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  16. A SOAP Response Message Message SOAP Envelope <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:getStockQuoteResponse xmlns:ns1="http://tempuri.org/lib.webservices.YahooStockQuote" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <return xsi:type="xsd:string">68.5</return> </ns1:getStockQuoteResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  17. WSDL overview

  18. Web Services Description Language Service port Binding PortType Message Type A Service Implementation Definition B 1 Service Interface Definition 2 3 4

  19. Service Interface Elements • import • types • message • portType • binding • Reference to data type definitions (ex. XML schema) • Contains data type definitions for messages • Abstract definition of data being transmitted • Set of abstract operations with references to messages • Concrete specification for operations and messages

  20. <message name=" getStockQuoteRequest"> <part name="strSymbol" type="xsd:string"/> </message> Java API getStockQuote(“2330”) <message name="setProxyResponse"> <part name="result" type="xsd:string"/> </message> Service Interface Elements Import java.net.*; : public class YahooStockQuote{ public String getStockQuote(String strSymbol){ { : getHTML(strSymbol); } : } 3 2 <portType name="YahooStockQuote"> <operation name=“getStockQuote"> <input message=" tns:getStockQuoteRequest "/> <output message="tns:getStockQuoteResponse"/> </operation> </portType> 4

  21. Service Interface Elements 1 <portType name="YahooStockQuote"> <operation name=“getStockQuote"> <input message=" tns:getStockQuoteRequest "/> <output message="tns:getStockQuoteResponse"/> </operation> </portType> <binding name="YahooStockQuoteBinding" type="tns:YahooStockQuote"> <operation name=“getStockQuote"> <input name="getStockQuoteRequest"> </input> <output name="getStockQuoteResponse"> </output> </operation> </binding> SOAP Message

  22. <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <soap:operation soapAction="" style="rpc"/> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/> Service Interface Elements 1 <binding name=" YahooStockQuoteBinding" type=" tns:YahooStockQuote "> <operation name=" getStockQuote "> <input name=" getStockQuoteRequest "> </input> <output name=" getStockQuoteResponse "> </output> </operation> </binding>

  23. Web Services Description Language Service port Binding PortType Message Type A Service Implementation Definition B 1 Service Interface Definition 2 3 4

  24. WSDL Document Types Service Interface Service Interface import import Service Implementation Binding Binding import PortType PortType Service Message Message Port Type Type • Service Implementation • Service Interface • Implementation of one or more service interfaces • Contains the endpoint reference • Abstract, reusable service definition • Represents a type of service that can be implemented

  25. <binding name="YahooStockQuoteBinding" type="tns:YahooStockQuote"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getStockQuote"> <soap:operation soapAction="" style="rpc"/> <input name="getStockQuoteRequest"> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/> </input> <output name="getStockQuoteResponse"> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/> </output> </operation> </binding> Binding Service Implementation Elements B A <service name="YahooStockQuoteService"> <port binding="binding:YahooStockQuoteBinding“ name="YahooStockQuotePort"> <soap:address location="http://localhost:82/SOAP_Provider/servlet/rpcrouter"/> </port> </service>

  26. UDDI overview

  27. Universal Description, Discovery and Integration • A project to speed interoperability and adoption for web services • Partnership among industry & business leaders • Standards-based specifications for service • description and discovery • Shared operation of a web-based business registry • Initiated by Ariba , IBM and Microsoft • Now over 300 UDDI community members

  28. A mid-sized manufacturer needs to create 400 online relationships with customers, each with their own set of standard and protocols. BroaderB2B A flower shop in Australia wants to be “plugged in” to every marketplace in the world, but doesn’t know how Smarter Search A B2B marketplace needs to get catalog data for relevant suppliers in its industry, along with connections to shippers, insurers, etc. Easier Aggregation Provide a standards-based profile for all electronic services that are provided. Includes web sites, other electronic resources Web Service Visibility Problems UDDI Solves Describe Services Discover Services IntegrateThemTogether Publish for Accessibility

  29. 4) Marketplaces, search engines, and business apps query the registry to discover services at other companies 1) Software companies, standards bodies and programmers populate the registry with references to these specifications (tModels) UDDI Registry Businesses &Services tModel Registrations 2) Businesses populate the registry with descriptions of the services they support 5) Businesses use this data to facilitate easier integration with each other over the Web How UDDI Works 3) UDDI manages each piece of data using a unique identifier key (either a UUID assigned by the registry, or a user supplied key)

  30. Many Types of UDDIRegistries • Private Scope • EAI catalog (entry points, data, load balancing) • Catalog for approved suppliers of goods and services • Controlled access • Semi-Private Scope • Enterprise portal - catalog of products and services for public searching • Enterprise-only publishing • Industry-specific marketplaces • Invitation-only membership for publishing • Public, invitation-only, fee-based options for searching • Public Scope • Unrestricted access to all content • Provides a “root registry” for use by other “affiliated” registries (more on this later) • Defines public business relationships between companies… • providers, suppliers, parents, subsidiaries, membership, certification Few

  31. SAP IBM Microsoft NTT The UDDI Business Registry • Prototypical public UDDI Registry • Peer nodes (websites) • Businesses register with any operator • Registrations replicated hourly • Complete set of “registered” records available at all operator nodes • Common set of SOAP APIs supported by all operators • Compliance enforced by business contract UDDI Business Registry

  32. Registry Data White Pages Yellow Pages Green Pages Service Type Registrations • Businesses register public information about themselves • Standards bodies, programmers, businesses register information about their service

  33. White Pages Yellow Pages Green Pages Service Type Registrations Registry Data Information about a Service Provider • Business Name • Text Description • Contact info • List of multi-language text strings • Names, phone number, • fax numbers, web sites…

  34. White Pages Yellow Pages Green Pages Service Type Registrations Registry Data Business categories • 3 standard taxonomies in V1 • Industry : NAICS • (Industry codes – US Govt.) • Product/Services : UN/SPSC(ECMA) • Location : Geographical taxonomy

  35. White Pages Yellow Pages Green Pages Service Type Registrations Registry Data • Technical info about services, specified by a business: how to "do e-commerce" with them • References to specifications for Web services • Support for pointers to various file and URL • based discovery mechanism if required How to bind to service provider

  36. JAX-RPC(JSR101)

  37. Java API for XML based RPC (JAX-RPC) • JSR 101: how Java developers use Web Services • Covers XML based RPC Web Services over SOAP (1.1) • Objective: Improved web service interoperability with common standards • JSR 101 clients< -- > JAX-RPC compliant server • JAX-RPC server < -- >any SOAP-RPC client

  38. Enterprise Web Services (JSR109)

  39. J2EE Web Services (JSR-109) • JSR-109 In a nutshell

  40. Static stub

  41. 關於Web Services Connection如果你只想記住三件事… 定位: Web Services 是由中央集權的 Web Application進化到 地方分治 的系統整合技術 技術: Web Services 是三大 標準化 技術的集成 • SOAP:SimpleObjectAccessProtocol • WSDL:WebServiceDescriptionLanguage • UDDI:UniversalDescriptionDiscovery andIntegration 應用: 生產力 = 專業知識 + 操作工具 後標準化時代 的核心競爭力在於創新的服務

  42. Web Services產業面臨的挑戰 理論上: Web Services 是四輪傳動的 精心設計…… 實際上: 這時候,我們非常需要 四輪傳動……而且是 真正的四輪傳動。

  43. Web Services 開發工具 • IBM, Sun, Microsoft, Oracle 是 Web Services 執行環境提供者 • WSAD, Visual Studio.Net, Forte… 是 Web Services 主要開發工具

  44. Service Requestor Service Provider Service Provider Service Requestor Service Provider Service Requestor Service Requestor Service Provider Web Services 的特性 • Services: 滿足期望的作為 • Web Services: 滿足眾人期望的作為 • 經常,滿足「眾人」遠比滿足「期望」更 具挑戰性。以麥當勞為例。 • Web Services 是以滿足眾人為前提的技術 Publish Service Provider Service Requestor

  45. 什麼不必是 Web Services ? • 單純的 RAC (Remote Application Call) 不是Web Services • 同一平台上的 AC,不是Web Services • 它連 Remote 都談不上 • 同一語言開發下的 RAC,不必是Web Services • proprietary call 即可,不必勞駕 SOAP • 少數人使用的 RAC,不必是Web Services • proprietary IDL 即可,不必勞駕 WSDL • 多數人已知道的 RAC,不必是Web Services • 媒介機制已存在,不必勞駕 UDDI • 殺雞不必用牛刀!

  46. 我該開始進行 Web Services !? • 如果你對這問題應對自如…… 『貴公司的產品是Web-based?』 • 也企圖對這問題侃侃而談…… 『貴公司的產品是Web Services-based?』 • 那麼請把這問題反問你的 platform Vendor、 你的委外廠商(external)以及你的事業夥伴(internal)…… • 當他們都有看法時,最適當的時機可能已經錯過?

  47. WS-Security XACML Key: Time to “plateau” Less than two years Liberty SAML Two to three years Three to five years WSRP WS-I XML Encryption XKMS ebXML XML Signature BPEL XML WS-Coordination SOAP Visibility UDDI WS-Transaction WSDL Real Peak of InflatedExpectations Plateau ofProductivity Slope ofEnlightenment TechnologyTrigger Trough ofDisillusionment Maturity Web Services 技術總整理

More Related