95-702 Distributed Systems 1!Master of Information System Management 95-702 Distributed Systems Lecture 4: Web Services Chapter 19 of Coulouris95-702 Distributed Systems In A Nutshell 2!Master of Information System Management From Globus.org (Grid computing)95-702 Distributed Systems With Stubs 3!Master of Information System Management From Globus.org (Grid computing)95-702 Distributed Systems 4!Master of Information System Management Some Important Standards95-702 Distributed Systems 5!Master of Information System Management Some Important Standards Very important with respect to XML web services.95-702 Distributed Systems 6!Master of Information System Management Web Services • Provide service interfaces. • Communicate using request and reply messages made of SOAP or some other XML document. • Have an Interface Definition Language (IDL) called WSDL (Web Service Definition Language) • May be looked up in a web service UDDI registry (Universal Directory and Discovery Service). • Are language independent. • May be synchronous or asynchronous.95-702 Distributed Systems 7!Master of Information System Management Web Services Registry Client Service publish lookup Exchange xml95-702 Distributed Systems 8!Master of Information System Management Web Services Infrastructure and Components Security!Service descriptions (in WSDL)!Applications!Directory service!Web Services!XML!Orchestration!SOAP!URIs (URLs or URNs)! HTTP, SMTP or other transport!95-702 Distributed Systems 9!Master of Information System Management Communication Patterns • In general, web services use either a synchronous request- reply pattern of communication with their clients or they communicate by asynchronous messages. • The client does not block on asynchronous calls. Do you block when you are expecting an important phone call? If not then you are planning on handling the call asynchronously. • To allow for a variety of patterns, SOAP is based on the packaging of single one-way messages. • SOAP is used to hold RPC style parameters or entire documents. • SOAP may be used over different transports (SMTP, TCP, UDP, or HTTP)95-702 Distributed Systems 10!Master of Information System Management Service References • URI’s are Uniform Resource Identifiers. • URL’s are Uniform Resource Locator URI’s that include location information. Thus, resources pointed to by URL’s are hard to move. • URN’s are Uniform Resource Name URI’s that include no location information. • A URN lookup service may be used to determine a URL from a URN. • URL’s are the most frequently used form of URI. Examples (the third is from Wikipedia): 1. URL: http://www.cmu.edu/service 2. URN: urn:ISBN:0-111-2345-6 3. "you can find urn:ietf:rfc:3187 (URN) over at http://tools.ietf.org/html/rfc3187.html (URL)."95-702 Distributed Systems 11!Master of Information System Management Web Service Composition hotel booking!a!Travel Agent!flight booking!a!hire car booking!a!Service!Client!flight booking!b!hotel booking!b!hire car booking!b!What concerns are not shown? Transactions, Security (privacy, identification, authentication, authorization), Reliability, Orchestration tooling, Interoperability through Standards, RPC or Messaging, Service Level agreements95-702 Distributed Systems 12!Master of Information System Management SOAP • Defines a scheme for using XML to represent the contents of request and reply messages as well as a scheme for the communication of XML documents. • It is intended that a SOAP message can be passed via intermediaries on the way to the computer that manages the resources to be accessed. • The intermediaries may process the SOAP to provide security or transaction support as well as other services. • Typically, the SOAP header is processed by intermediaries and the SOAP body holds the request or reply.95-702 Distributed Systems 13!Master of Information System Management SOAP Envelope envelope!header!body!header element!body element!header element!body element!95-702 Distributed Systems 14!Master of Information System Management Request Without Headers m:exchange!env:envelope! xmlns:env =namespace URI for SOAP envelopes!m:arg1!env:body!xmlns:m = namespace URI of the service description!Hello!m:arg2!World!Why is envelope in a different namespace than arg1? Consider GreenBayPackers:MikeMcCarthy and CMU:MikeMcCarthy!95-702 Distributed Systems 15!Master of Information System Management Corresponding Reply env:envelope! xmlns:env = namespace URI for SOAP envelope!m:res1!env:body!xmlns:m = namespace URI for the service description!m:res2!World!m:exchangeResponse!Hello!95-702 Distributed Systems 16!Master of Information System Management HTTP POST Example endpoint address!action!POST /examples/stringer!Host: www.cdk4.net!Content-Type: application/soap+xml!Action: http://www.cdk4.net/examples/stringer#exchange!<env:envelope xmlns:env= !namespace URI for SOAP envelope!>!<env:header> </env:header>!<env:body> </env:body>!</env:Envelope>!Soap message!HTTP header!A transport protocol is required to send a SOAP document to its destination. Other transports may be used. WS-Addressing may be used to include destination and source. Thus, different protocols might be used over different parts of the route of a message.95-702 Distributed Systems 17!Master of Information System Management REST Style WS Use a URI and an HTTP method to select what needs to be done.!POST /examples/stringer!Host: www.cdk4.net!Drop the SOAP and use name value pairs for the request.!Use XML or JSON for the response.!Appropriate for ad-hoc mashups. Some believe that REST is not appropriate for enterprise computing.95-702 Distributed Systems 18!Master of Information System Management WS-Addressing <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"> <S:Header> <wsa:MessageID> uuid:6B29FC40-CA47-1067-B31D-00DD010662DA </wsa:MessageID> <wsa:ReplyTo> <wsa:Address>http://business456.example/client1</wsa:Address> </wsa:ReplyTo> <wsa:To>http://fabrikam123.example/Purchasing</wsa:To> <wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action> </S:Header> <S:Body> ... </S:Body>
View Full Document