1.3k likes | 1.46k Views
The Joy of Web Services. Slides are available at: http://vermont.mvc.mcc.ac.uk/JoyOfWebServices.ppt. Mark Mc Keown mark.mckeown@man.ac.uk. The Deliverables…. Web services SOAP WSDL UDDI SOA - Service Orientated Architecture WS-Security WS-* Grid Services & OGSI WSRF REST
E N D
The Joy of Web Services Slides are available at: http://vermont.mvc.mcc.ac.uk/JoyOfWebServices.ppt Mark Mc Keown mark.mckeown@man.ac.uk
The Deliverables… • Web services • SOAP • WSDL • UDDI • SOA - Service Orientated Architecture • WS-Security • WS-* • Grid Services & OGSI • WSRF • REST • WS-Transfer • processThis Supercomputing, Visualization & e-Science
What is a service? “A service is a well-defined set of actions, it is self contained, stateless, and does not depend on the state of other services” “A Grid Application Framework based on Web Service Specifications and Practice”, WS-GAF, 2003. (definition now obsolete) Supercomputing, Visualization & e-Science
What is a service… “A service is the logical manifestation of some physical or logical resources (databases, programs, devices, humans, etc) and/or some application logic that is exposed to the network” plus “Service interaction is facilitated by message exchanges” Web Service Grids: an Evolutionary Approach, July 2004 (WSG) Supercomputing, Visualization & e-Science
What is a service… “In computing terms, a ‘service’ is simply a function that can be invoked via a well-defined remote interface ” OGSI primer Supercomputing, Visualization & e-Science
What is a service… “A service is an abstract resource that represents a capability of performing tasks that represents a coherent functionality from the point of view of provider entities and requester entities. To be used, a service must be realised by a concrete provider agent” W3C Web Services Architecture, Feb 2004 (WSA) Supercomputing, Visualization & e-Science
What is a Web Service? • “A Web service is a software system designed to support interoperable machine-to-machine interaction over a network.” • “It has an interface described in a machine-processable format (specifically WSDL).” • “Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.” W3C – Web Services Architecture Supercomputing, Visualization & e-Science
SOAP over HTTP HTTPHeaders <soap:Envelope> <soap:Header> XML… </soap:Header> <soap:Body> XML payload… </soap:Body> </soap:Envelope> Supercomputing, Visualization & e-Science
References • WS-GAF - http://www.neresc.ac.uk/ws-gaf/documents.html • Web Service Grids - http://www.nesc.ac.uk/technical_papers/UKeS-2004-05.pdf • W3C Web Services Architecture - http://www.w3.org/TR/2004/NOTE-ws-arch-20040211/ • OGSI V1.0 Primer - https://forge.gridforum.org/projects/ogsi-wg/document/draft-ggf-ogsi-gridserviceprimer/en/1 Supercomputing, Visualization & e-Science
Before SOAP came XML-RPC… • XML-RPC is a web services protocol that implements remote procedure calls over HTTP. • Pre-dates SOAP, was based on a early version of the SOAP specification. • XML-RPC a uses simple XML application to express function calls (requests) and returned values (responses) between clients and servers. • For more on XML-RPC see http://www.xmlrpc.com Supercomputing, Visualization & e-Science
SOAP • Simple Object Access Protocol? or • Service Orientated Access Protocol? • “Originally the acronym stood for Simple Object Access Protocol, but that name is now considered to be outdated, so it no longer stands for anything” OGSA Glossary Supercomputing, Visualization & e-Science
SOAP “SOAP provides a simple lightweight mechanism for exchanging structured and typed information between peers in a decentralized, distributed environment using XML” Microsoft Supercomputing, Visualization & e-Science
SOAP Structure Envelope Header Body Message Pay Load Supercomputing, Visualization & e-Science
SOAP structure • Envelope – contains the entire SOAP message • Header – (optional) contains an header information – we will see this used later. • Body – contains the application pay load. • Message Payload – the part of the message that is intended for the application. Supercomputing, Visualization & e-Science
Sample SOAP <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schema.xmlsoap.org/soap/envelope/” xmlns:SOAP-ENC=“http://schema.xmlsoap.org/soap/encoding/” SOAP-ENV:encodingStyle=“http://schema.xmlsoap.org/soap/encoding”> <SOAP-ENV:Body> <getHostname/> </SOAP-ENV:Body> </SOAP-ENV:Envelope> • Invokes the “getHostname” operation on the Web service. Supercomputing, Visualization & e-Science
Response <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Body> <getHostnameResponse> <getHostnameReturn xsi:type=“xsd:string”> foobar.man.ac.uk </getHostnameReturn> </getHostnameResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Supercomputing, Visualization & e-Science
SOAP Faults • The Envelope element may contain a Fault element. <soap:Fault> <faultcode>12</faultcode> <faultstring>no such host</faultstring> </soap:Fault> Supercomputing, Visualization & e-Science
Faults The Fault element can have the following • faultcode • Allows the service to pass an error code to the client • faultstring • Allows the service to provide an error message • faultactor • Where did the error originally originate • detail • Specific detail about the error Supercomputing, Visualization & e-Science
RPC Style • RPC – Remote Procedure Call, similar to making a function call. int add( int value1, int value2 ) <body> <add> <value1 xsd:type=“int”>10</value1> <value2 xsd:type=“int”>5</value2> </add> </body> Supercomputing, Visualization & e-Science
Document Style • Rather than the service providing remote functions - we can think about exchanging messages with a service. <MathsOperation> <Operation name=“ADD”> <Arg>5</Arg> <Arg>10</Arg> </Operation> </MathsOperation> Supercomputing, Visualization & e-Science
Document Style… <MathsOperation> <Operation name =“ADD”> <Operation name=“ADD”> <Arg>5</Arg> <Arg>10</Arg> </Operation> <Arg>3</Arg> </Operation> </MathsOperation> Supercomputing, Visualization & e-Science
Document Hell… • <ogsi:TerminationTime before=“XXX” after=“XXX” /> • XXX can be either xsd:datetime, now, infinity or rubbish. • after is a time before before (!?). • 16 possible combinations! Supercomputing, Visualization & e-Science
SOAP References • SOAP specification - http://www.w3.org/TR/soap/ • The SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/ • The SOAP encoding namespace: http://schemas.xmlsoap.org/soap/encoding/ • RPC v Document Style • http://www-106.ibm.com/developerworks/webservices/library/ws-whichwsdl/ • “A Critique of the Remote Procedure Call Paradigm” by Tanenbaum & Van Renesse EUTECO’88. • OGSA Glossary - https://forge.gridforum.org/projects/ogsa-wg Supercomputing, Visualization & e-Science
WSDL Web Service Description Language
WSDL – Web Service Description Language • Describes the Web service interface: the messages that can be exchanged, the operations, where to contact the service, what transport protocols can be used etc… • A bit like a header file for a library – but holding a lot more information. • Does not describe what the service does, how it does it or how you should use the service – ie does not provide semantic information about the service. Supercomputing, Visualization & e-Science
Contents of a WSDL document • Types– a container for data type definitions using some type system (such as XSD). • Message– an abstract, typed definition of the data being communicated. • Operation– an abstract description of an action supported by the service. • Port Type–an abstract set of operations supported by one or more endpoints. • Binding– a concrete protocol and data format specification for a particular port type. • Port– a single endpoint defined as a combination of a binding and a network address. • Service– a collection of related endpoints. Supercomputing, Visualization & e-Science
A WSDL Document <?xml version=“1.0” encoding=“UTF-8”?> <definitions> <types> <!– defines the types that will be used --!> </types> <message> <!– XML messages, composed from types, used in exchanges --!> </message> <portType> <!– define operations --!> <portType> <bindings> <!– define transport protocols --!> </bindings> <service> <!– location of service, the service endpoint --!> </service> </definitions> Supercomputing, Visualization & e-Science
Types – sample form WSDL specification <types> <schema targetNamespace=http://example.com/stockquote.xsd xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="TradePriceRequest"> <complexType> <all> <element name="tickerSymbol" type="string"/> </all> </complexType> </element> ….. </schema> </types> Supercomputing, Visualization & e-Science
Messages <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> <message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/> </message> Supercomputing, Visualization & e-Science
portType <portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> </portType> Supercomputing, Visualization & e-Science
Binding <binding name="StockQuoteSoapBinding type="tns:StockQuotePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GetLastTradePrice"> <soap:operation soapAction="http://example.com/GetLastTradePrice"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> Supercomputing, Visualization & e-Science
Service <service name="StockQuoteService"> <documentation>My first service</documentation> <port name="StockQuotePort“ binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> </service> Supercomputing, Visualization & e-Science
WSDL • Generally WSDL is only ever written and consumed by machines, for example WSDL2java will generate client stubs in Java for you given a WSDL file. • WSDL does not provide any semantic information about the service, what it does and how you should interact with it. Supercomputing, Visualization & e-Science
Service Description – from W3C WSA Supercomputing, Visualization & e-Science
WSDL Refences • WSDL specification - http://www.w3.org/TR/soap/ • W3C Web Service Architecture - http://www.w3.org/TR/2004/NOTE-ws-arch-20040211/ Supercomputing, Visualization & e-Science
UDDI Universal Description, Discovery and Intergration
Service Discovery: Registry, Index or Peer-to-Peer. • A registry is an authoritative, centrally controlled store of information. • An index is a compilation or guide to information that exists elsewhere. • P2P allows Web services to discover each other dynamically • UDDI is often seen as an example of the registry approach, but it can also be used as an index. Supercomputing, Visualization & e-Science
UDDI The UDDI specification defines the following: • The schema for UDDI XML documents. • The programmers API: • Publishing operations • Access operations. • How to do Replication between UDDI hosts. • Operators specification – how UDDI registry operators should host a UDDI service. Supercomputing, Visualization & e-Science
UDDI A UDDI registry categorises information along the lines of a US phone book: • White pages: business names and addresses. • Yellow pages: business type listing. • Green pages: listings based on provided services. Supercomputing, Visualization & e-Science
UBR – Universal Business Registry • The UBR is a free, public UDDI registry currently jointly operated by IBM, Microsoft, NTT Communications, and SAP. • Anyone is free to publish information to any of the UBR nodes and to query any of these. • The entry is replicated between the various nodes – register in one node and your entry will appear in all nodes. • http://uddi.org/find.html • An organisation can set up their own private UDDI registry. Supercomputing, Visualization & e-Science
UK e-Science UDDI registry • The UK e-Science community is setting up a UDDI registry for e-Science users. • The registry will be replicated between four sites (Oxford, Daresbury, Cardiff and Edinburgh). • http://tyne.dl.ac.uk/ETF/public/Registry/index.shtml Supercomputing, Visualization & e-Science
UDDI References • For all things UDDI – http://www.uddi.org/ Supercomputing, Visualization & e-Science
SOA Service Orientated Architecture.
SOA – Service Orientated Architecture • “This term is increasingly used to refer to an architectural style of building reliable distributed systems that deliver functionality as services, with the additional emphasis on loose coupling between interacting services.” OGSA Glossary • But not the “Object Orientated Architecture” Supercomputing, Visualization & e-Science
Publish, Find and Bind Triangle Supercomputing, Visualization & e-Science
Characteristics of SOA – WS-Architecture • Logical view: The service is an abstracted, logical view of actual programs, databases, business processes, etc. , defined in terms of what it does, typically carrying out a business-level operation. • Message orientation: The service is formally defined in terms of the messages exchanged between provider add requester agents, and not the properties of the agents themselves. • Description orientation: A service is described by machine-processable meta data. Supercomputing, Visualization & e-Science
Characteristics of SOA – WS-Architecture • Granularity: Services tend to use a small number of operations with relatively large and complex messages. • Network orientation: Services tend to be orientated toward use over a network. • Platform neutral: Messages are sent in a platform-neutral, standardized format delivered through the interfaces, XML is the most obvious format that meets this constraint. Supercomputing, Visualization & e-Science
Another view of SOA… Supercomputing, Visualization & e-Science
Characteristics of SOA – WS-Grids • Boundaries are explicit: The boundaries of a service are well defined when they are incorporated into a distributed applications. Other services do not see the internal workings, implementation details, or resource representation of a service. • Services are autonomous: Service implementations are developed and evolve independently from each other. Supercomputing, Visualization & e-Science