890 likes | 1.25k Views
XML , Web Services and Middleware. 國立台灣師範大學 資訊教育系 葉耀明 ymyeh@ice.ntnu.edu.tw. 內容大綱. 第二代 Web 與 Component Software 何謂 Middleware Middleware 的演進 CORBA 的概念 Web Service 的概念 Web Services 的發展過程 Web Services 的架構 SOAP WSDL UDDI Web Service 與 ebXML Web Services 的應用 台灣的殺手級應用: e-Taiwan 計畫
E N D
XML, Web Services and Middleware 國立台灣師範大學 資訊教育系 葉耀明 ymyeh@ice.ntnu.edu.tw
內容大綱 • 第二代Web與Component Software • 何謂Middleware • Middleware的演進 • CORBA的概念 • Web Service的概念 • Web Services的發展過程 • Web Services的架構 • SOAP • WSDL • UDDI • Web Service與ebXML • Web Services的應用 • 台灣的殺手級應用:e-Taiwan計畫 • 總結
網路發展過程 • 1960-:網路源起 • Bitnet, IBM Network (獨立網路) • ARPANET: TCP/IP (1968-) • 1980-:Internet • WAN:TCP/IP (網路進入網網相連時代) • LAN:Ethernet, Token Ring • 1990-:World-Wide Web(第一代) • HTML (1989-) (網路進入多媒體時代) • 2000-: World-Wide Web(第二代) • XML (1998-) (網路進入自動化資訊處理時代)!!! • Web Services (2001-) (程式獨立於網頁之外)
下一代全球資訊網(一) web data web data • 全球性網路整合知識庫 • 全球性網路整合服務 web service web service web data web data web service web data web data
下一代全球資訊網(二) • 第一代Web: HTML • 網頁資訊Web Data (for human) • 第二代Web: XML • Web Data: Semantic Web (XML網頁)可形成整合知識庫的知識網頁 • XML Schema/RDF/OWL (for human & machine) • Web Service: 可透過網路動態整合的網路服務Web program, Web software (XML訊息) • SOAP/UDDI/WSDL (for human & machine) • Software in a nodeSoftware integrated through Web
中介軟體Middleware的概念 • Middleware的定義 • 起源: • 主從架構技術:RPC • Intranet Middleware: • CORBA/DCOM/RMI • Internet Middleware: • Web Service
Types of Distributed Processes send receive B A • Peer-to-Peer • Send/Receive • Role: no • Application: MP3 exchange • Filter • Receive/Forward • Role: calling/filter/called • Application: Router, Proxy Server • Client/Server • Request/Reply (or Response) • Role:Client/Server • Application: WWW, MIS, Agent… • Multicast • Multicast/response • Role: Coordinator/Partner • Application: B2B Collaboration, Media Distribution receive send B C A filter called calling calling request B A reply server client B partner reply A B coordinator B multicast
Type of Client/Server System • Desktop client • Traditional client/server • Intrasystem client/server • DDE (Dynamic Data Exchange) Server • Browser/Personal Web Server • Desktop server • X-terminal
Client/Server Architecture • 3 Layer Architecture Client Server AP AP AP OS System Services System Services Hardware Hardware Hardware Fundamental AP Client/Server AP
Middleware的定義 • Middleware: a layer of software whose purpose is to mask heterogeneity and to provide a convenient programming model to application programmers. • Middleware[Renaurd]:提供control integration,做data management, communication management, object management Client Server AP AP API API Middleware Middleware OS OS Protocol Hardware Hardware Client/Server AP 註:Application Program Interface
Application Framework APPLICATION User Interface Presentation Interface Userware Task Management Control Integration Middleware Data Repository Enterpriseware System Service Computer and Communication Facility Hardware
Middleware Framework Foundation Components Control Integration Data Management Communication Management Object Management Data Repository Federated Distributed Data Base System Service System API RPC Operating System Session Layer Transport Layer Network Layer Computer and Communication Facility Device Driver
OSI 7 Layers ORB Application Layer 應用層 network service RPC Presentation Layer 表現層 data conversion RPC Session Layer 交談層 Socket connection service RPC Transport Layer 傳輸層 TCP, UDP end-to-end delivery Network Layer 網路層 routable packet IP Data Link Layer 資料鏈結層 Ethernet MAC data frame Physical Layer 實體層 Ethernet Base-band raw bit stream
Procedure Call的發展 • Procedure Call • Pascal, C • Compiler provides mechanisms • Inter-Process Communication (IPC) • C • OS provides service • Remote Procedure Call (RPC) • ODBC, HTTP/HTML • Middleware provides service • Object-Oriented Remote Procedure Call (OORPC) • CORBA(IIOP, GIOP), DCOM • XML-based Remote Procedure Call (XML-Based RPC) • XML-RPC (Remote Procedure Call) • SOAP (Simple Object Access Protocol) • WDDX (Web Distributed Data Exchange)
Procedure Call Process • Process內的Procedure Call • Same Address Space • Pascal, C • Compiler provides mechanisms • Procedure name linking • Parameter binding • Variable Stack Main(){… call pc(a,b,c); …} Procedure pc(x,y,z){… Return(z=result); }
Inter-Process Communication (IPC) • Node內的Procedure Call • Same Operating System • C; SVC (supervisor call) • OS provides service • Process IDProcedure name • Message Passing • Send/Receive Process A Process B Main(){… send(pid,a,b); receive(pid,c); …} receive(pid,x,y))… send(pid,z);
RPC (Remote Procedure Call) • 用RPC做concurrent process由White 1976提出 • Node間的Procedure Call • Different Operating System • VB, Delphi, VC++, ODBC • Middleware provides service • NodeIDProcess IDProcedure name • Message Passing • Request/Reply
RPC Protocol Client Process Server Process Main(){… call rpc(a,b,c); …} RPC Library HARNESS: Main(){ Receive((x,y),client) Call rpc(x,y,z); Send(z,client) } Request RPC Library STUB: rpc(a,b,c){ send((x=a,y=b),server) Receive(c=z,server) Return(c); } Reply Application Procedure rpc(x,y,z){… Return(z=result); }
Client/Server Communication的特性 • Client特性:主動者 • GUI • Server特性:被動者 • Data Processing, Computing, . . . • Communication特性: • Transactional: • atomic:原子性 • consistency:一致性 • isolation:獨立性 • serialization:循序性 • durability:永久性 • Cooperative: not master/slave
RPC ISSUES • Connection: 連線方式 • Connectionless封包式: datagram(packet switched) • Connection-oriented連線式:datastream(circuit switched) • Addressing: 位址取得 • Name resolution:名稱解讀 • Dynamic binding:動態連結 • Synchronization: 同步方式 • Failure Handling:容錯處理 • Security:安全 • Data Conversion;資料格式轉換
Connection Issues • Circuit switching: connection-oriented • 電話網路, • Packet switching: connectionless • TCP/IP • Hybrid: • connectionless(low level) + connection-oriented(high level) • ATM
Addressing Issues • by name: object X • by address: object at location x • by content: object with value x • by route: object found at end of path x • by source: all my objects • broadcast identifier: all objects of type x • group identifier: all objects related to x
Static Binding • Internet較低階部份用static binding (compile time) • global name: • network+subnetwork+host+process-id+name • internet domain name: user@subdomain.domain e.g. renaud@bnr.ca • 有時加上hostname eg: myhost.renaud@bnr.ca socket context server nameport (8 bit) network context portIP address (32 bit) datalink context IP addressEthernet address (48 bit) TCP/IP layered naming context
Dynamic Binding • client/server 較高階部份用(run time) • via convention: 用configuration convention • 用environment variable: set MYSERVER=123456 • 用configuration file:含global name table • via broadcast:提供name resolution service • Microsoft NetBEUI(NetBIOS Extended User Interface)網路上的芳鄰 • via name server • Novell SPX/IPX
Microsoft NetBEUI(NetBIOS Extended User Interface) Remote NetBIOS Server Client Local NetBIOS Update Name Table Update Name Table Send(“Server4 at address46,broadcast) ADD.NAME “Server4” ADD.NAME “client21” Update Name Table Send(Client21 at address21”, ,broadcast) LISTEN Session Starts CALL “Server4” Receive Receive Session 1 Process message” Send “Reply”,”client21” HANGUP Update Name Table Receive Session Starts SEND“Request”, ”Server4” Lookup Name Send(Session1,Address46) Lookup Name Send(Reply,address21) RECEIVE Session1 Process Message HANGUP Lookup Name Send(Request,Address46,Session1)
Novell SPX/IPX Client@987654 Bindery Server@123456 AdvertiseServer “GreatServer” ScanBindery “GreateServer” Address 123456 Address 123456 Socket 78 IPXOpenSocket IPXGetLocalTarget Socket 78 IPXSendPacket [(0,123456,78),(0,987654,32),Request] IPXReceive Process Message IPXSendPacket [(0,987654,32),(0,123456,78),Reply]
Synchronization Issues • blocking protocol: • blocking send/blocking receive :synchronized • strict RPC • nonblocking protocol: • nonblocking send/nonblocking receive • master/slave: rendezvous model
Master/slave Server process Server Process Client Process MASTER: Loop( ) {receive((x,y),client) spawn slave(x,y,client) } Main(){… call rpc(a,b,c); …} Request SLAVE:{ call rpc(x,y,z); send(z,client) } RPC Library STUB: rpc(a,b,c){ send((x=a,y=b),server) Receive(c=z,server) Return(c); } Reply Application Procedure rpc(x,y,z){… Return(z=result); }
Failure Modes • client call後crash: • 處理: client discard message • message lost: • 處理: 用ACK, timeout, resend: three-packet protocol: request, reply, ACK • no-more-than-once RPC semantics:用sequence number控制server resend • server crash: • 處理: (1)client resend call, retry幾次後,依靠server callback或user abort request • (2)server做atomic-transaction service • server lost message
Three-Packet Protocol Server Process Client Process RPC Library HARNESS: Main(){ Receive((x,y),client) Check rpc Sequence if Sequence > Last Msg call rpc(x,y,z); } Main(){… call rpc(a,b,c); …} Request RPC Library STUB: rpc(a,b,c){ Inc RPC Sequence No. send((x=a,y=b),rpc) receive(c=z,server) if (Timeout(receive)) retry else send(ACK,rpc) Application Procedure rpc(x,y,z){… Return(z=result); } Reply resend Inc Last Msg send(z,caller) receive(ACK,caller) if (Timeout(receive)) resend(z,caller) ACK
CORBA (Common Object Request Broker Architecture) • 由 OMG (Object Management Group)所制定的分散式物件標準規格 • 目前為CORBA 3.0 • 介面定義語言 (IDL; Interface Definition Language) 讓各種語言所寫成的物件可以達到共用的目的 • 以 ORB (Object Request Broker)為物件間溝通的管道
CORBA Architecture Common Facilities Application Objects CORBA ORB ... ... Event LifeCycle Query Naming Time Common Object Services (16)
CORBA 架構 Java C++ Ada Java C++ Ada IDL IDL IDL Client Stub Server Skeleton CORBA ORB
Web Services的發展過程 • SOAP發展: • XML-Based Remote Procedure Call: Loosely-Coupled Distributed System • XML-RPC: Userland • WDDI: WebMethod • SOAP:Microsoft • SOAP 1.2: W3C (Web基礎建設的一環) • UDDI/WSDL發展 • UDDI協會:產業電子目錄 • Microsoft, IBM, Ariba • Basic SOA (Web Services基礎架構) • Web Services發展:SOA (e-Business主軸技術) • OASIS協會:和ebXML整合 • WS-Security • WS-Reliability • WS-Choreography • WSDM (Distributed Management)
Web Services 技術概念:SOA: Services Oriented Architecture Service Broker WSDL 新型態的入口網站: - 給程式(Web Service)用的 UDDI Publish Request SOAP Service Requester Service Provider Bind and Request Reply UDDI 2.0: Universal Description, Discovery and Integration (2001/6) WSDL: Web Service Description Language SOAP: Simple Object Access Protocol (2001/7)
Basic Web Services Stack Service Publication/Discovery UDDI Service Description WSDL XML Messaging SOAP Transport Network HTTP,SMTP,FTP over TCP/IP
一個Web Service是什麼? • Some software functional block • Location, platform, code are irrelevant • “Loosely coupled software components that encapsulate discrete functionality and that are accessible over standard Internet protocols.”—The Stencil Group • “Web Services are a new breed of web application. They are self-contained, self-describing, modular applications that can be published, located, and invoked across the Web.”– IBM • Web服務的提供者;Web的主要居民 • 資訊系統的動態組件
Service-Oriented Architecture:Conceptual Model Business or Application Standards Business Content Industry Vertical Content Universal Business Content Management Registry/Repository Security Technical Infrastructure Standards Business Process-Workflow Partner Profiles Reliable Messaging Core XML Standards Network/Transport Platform
Directory (UDDI) Inspection (WSIL) Discovery Architecture of Web Services:Extended SOA WS-Security (Federation, Trust, Conversation, SecurityPolicy) Management WSDM WS-Reliable Messaging WS-Reliability WS-Addressing WS-Attachments (DIME) Process Flow and Pattern Description (Workflow, Orchestration, Transaction, Policy, Portal) RDF (meta data) Semantic Web Service Description (WSDL) SOAP Structure (XML Schemas) XML Description Messaging/Wire (Invocation)
Web Services Implementation UDDI Registry Service Discovery Service Publish Business Functionality Web Services System Web Services Client Service Description WSDL Web Server Web Service Runtime SOAP over HTTP SOAP
Web Service的運作模式 • 兩種Web Service型態 • Message Producer • 做服務動作和加內容到訊息內 • Message Consumer • 取用訊息內容和做服務動作 • Pipeline:message flow • Pipeline is a sequence of services • Messages grow and shrink on the way
Web Services的發展類型 • Enterprise Web Services • 新型態的EAI (Enterprise Application Integration) • 使用技術:LAN+SOAP+WSDL • Internet Web Services • 新型態的B2Bi (Business to Business Integration) • 使用技術:Basic SOA • SOAP+UDDI+WSDL • Internet Security • Semantic Web Services • Integrated e-Business (Global e-Marketplace) • 使用技術:Extended SOA • SOAP+UDDI+WSDL • WS-Security+WS-Reliability+WS-Choreography+WSDM • 整合Semantic Web Architecture • RDF+OWL+XTM(XML Topic Map) …
Business Collaboration Through Web Service Integration Wrap intra-enterprise Application Wrap intra-enterprise Application Business Process Layer WSFL,XLANG,ebXML, Rosettanet Web Services Web Services Content Layer WSDL,ebXML,Rosettanet EAI EAI Workflows ERP Workflows ERP Communication Layer SOAP,HTTP,FTP,SMTP Components Components B2B Interactions Data Repository Data Repository Business Partner 2 Business Partner 1
Attachments (binary) Routing intermediaries Reliable Messaging Qos Security Context/Privacy Transactions SOAP XML Messaging/Wire (Invocation) Invocation: SOAP
Why XML-Based RPC ? COM/CORBA Client or Server XML-Based RPC Client or Server Fire Wall HTTP: port 80 Server (WEB) Server
Tightly-Coupled System v.s. Loosely-Coupled System • 平行處理系統 • Tightly-Coupled System:Shared memory, Synchronous • Loosely-Coupled System:Distributed memory, Asynchronous • 分散式系統 • Tightly-Coupled System:LAN-based Distributed System • CORBA, DCOM • Loosely-Coupled System:Web-based Distributed System • XML-RPC • SOAP
Tightly Coupled Distributed System Server2 Request Server1 GetCurrency(country) Reply Request GetExchangeRate(currency) Reply Request SubmitExchange(amount,currency) Reply
Loosely Coupled Distributed System Request Server2 Server1 <method> GetCurrency(country) GetExchange(currency) SubmitExchange(amount,currency) </method> Reply <response> reply data … </response>