330 likes | 916 Views
MSc Course in Advanced Distributed Systems Session 1.2b: Introduction to Web Services. Information. Contact Dr. Paul Grace C21, Infolab21 p.grace@lancaster.ac.uk Reading Newcomer chapter 1: “Introducing Web Services” Web Services Architecture specification http://www.w3.org/TR/ws-arch/
E N D
MSc Course in Advanced Distributed SystemsSession 1.2b: Introduction to Web Services
Information • Contact • Dr. Paul Grace • C21, Infolab21 • p.grace@lancaster.ac.uk • Reading • Newcomer chapter 1: “Introducing Web Services” • Web Services Architecture specification • http://www.w3.org/TR/ws-arch/ • Example services – www.xmethods.net
Introduction to Web Services • Aims of the lecture • To appreciate the motivations behind Web Services • To understand the technologies associated with Web Services • To appreciate how Web Services compare to other middleware technologies • To understand the limitations of Web Services
What are Web Services? • New, emerging distributed systems technology • Loosely-coupled, Service-oriented approach • Major industrial players (IBM, Microsoft, Sun etc.) supporting its development • The next step in improving interoperability and overcoming heterogeneity • CORBA, EJB provide tightly coupled interoperability • Web Services aims to provide open integration • An evolving Web standard • World Wide Web Consortium (W3C) committees e.g. WSAG developing specs • http://www.w3.org/2002/ws/
What is a Web Service? • Often incorrectly described or misinterpreted • “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 a web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialisation in conjuction with other Web related standards.”WSA specification 08/08/03
Why Web Services (1) ? • What is middleware good at? • Overcoming heterogeneity and Interoperability problems • What problems are there with middleware? • Tightly coupled client/server models • Development between specified parties (company A and company B) • What is the WWW good at? • Human interaction with text and graphics • Open publication of information • Can we utilise the WWW to support application to application interaction?
Amazon.co.uk Amazon.co.uk Amazon.co.uk Play.com CNN The World Wide Web (WWW) Amazon BBCi • Web pages published to a wide audience • Open to read by anyone • Client can dynamically search, choose and browse Discover & Interact
Why Web Services (2)? • Take existing software implementation & make it widely available • Existing legacy code, database, CORBA objects, EJB components etc… • Scope of publication not supported in CORBA, DCOM, EJB … • Applications can dynamically discover services that meet their requirements • Software-oriented interactions automatically perform operations that previously required manual intervention
An example application 9pm: Reservation at Paris restaurant Calendar on PDA Restaurant Web Service Grand Hotel Hotel Web Service Ibis Hotel Airline Web Service Air France EasyJet British Airways
Why Web Services (3)? • Software solutions heterogeneously implemented • Different middleware e.g. EJB, DCOM and CORBA services • Problem of Enterprise Application Integration • Web Services are abstract entities • Higher level framework of interoperation • The same client can interoperate with any implementation
Web Services Interactions • Middleware typically encompasses a single interaction style • Web Services offer a higher level abstraction, encompassing: • RPC, Asynchronous messaging, One-way messaging, Broadcast & Publish\Subscribe • However, only two styles are typically used • Remote Procedure Call • Documented Oriented Messaging
Remote Procedure Call Interactive Order request/response
Document Oriented Interaction Workflow of purchase order
Web Services in Action • Web Services are available for you to use today • Google • E.g. Google Maps API - http://www.google.com/apis/maps/ • Amazon • E.g. S3 storage service, catalogue api • http://www.amazon.com/AWS-home-page-Money/b?ie=UTF8&node=3435361 • Flickr • http://www.flickr.com/services/api/ • Microsoft Live • E-bay • http://developer.ebay.com/developercenter/soap/ • And many others
Example: Combining Services • Google Maps + craigslist rentals= housingmaps.com
Web Services Core Technologies • Discovery • Description • Interaction UDDI X M L WSDL SOAP
XML (Extensible Markup Language) • Basic foundation of Web Services • Base language for defining data and how to process it • Overcomes limitations of HTML • Data has meaning • Elements (tags) associate meaning with data • XML Schemas ensures that everyone uses the same elements in the same way • If two parties share an XML document and the same XML schema they understand the same content • This is exactly how Web Services work • All messages exchanged are XML documents
Web Services Description Language (WSDL) • XML language for interface definition of each Web Service • Similar to CORBA and DCOM IDL • If sender & receiver share and understand same WSDL file, interoperability is guaranteed • Key technology in supporting enterprise application integration • Separation of abstract service description from concrete messaging format • Divided into three major elements • Data type definitions, Abstract definitions & Service bindings
Data Type Definitions <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> <element name="TradePrice"> <complexType><all> <element name="price" type="float"/> </all></complexType> </element> </schema> </types>
Abstract Definitions <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> <message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/> </message> <portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> </portType>
Service Bindings <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> <service name="StockQuoteService"> <documentation>My first service</documentation> <port name="StockQuotePort“ binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> </service> • Bindings to SOAP, HTTP & MIME -> Others ??
SOAP • The SOAP specification defines a messaging framework designed for exchanging formatted XML data across the Internet. • Neutral with respect to operating system, programming language, or distributed computing platform. • Fundamentally, a one-way communication model • Adapted to perform RPC • Transfer complete XML documents • Abstract communication protocol • Bridge between heterogeneous implementations
Discovering Web Services (3 Styles) • Registry style • Authoritative, centrally controlled e.g. UDDI • Index approach • Open, centralized, free market model • 3rd party information included • E.g. Google index • Peer-to-Peer discovery • Decentralised, suited to alternative environments e.g. ubiquitous, ad-hoc
UDDI: Publishing & Discovering Web Services • Universal Description, Discovery & Integration (UDDI) • A Web Service registry & discovery mechanism for retrieving pointers for web services interfaces • UDDI is like a yellow pages directory • Companies register extra contact information • Vendors Publish information about services • Clients search for matching services • Centralised discovery mechanism
Return matching service info Submit data to registry Create WSDL describing Web Service Query registry for WSDL Use WSDL to generate correct messages Interact with discovered service Web Service Discovery
The Future ? • Web Services are primitive compared to established middleware • Cannot specify or search by non-functional service properties (cost, security, QoS etc.) • Simple interactions are currently only available • Work in progress on both e.g Choreography group, semantic search • Further Integration (without SOAP) • Web Services Invocation Framework • New domains • Mobile Computing & Ubiquitous Computing
Analysis • The new silver bullet? • Web Services do not solve much by themselves • Web Services are a new layer, or another way of doing things • Important because they bridge technology domains • Allow new Interaction styles • Promote open publication of software services • Solve Enterprise Application Integration • XML & WSDL are the key technologies
Web Services Limitations and RESTful Web Services • The Web Service Stack is heavyweight • Difficult to understand • Difficult to implement • Interoperability is still difficult to achieve • A growing number of advocates are proposing RESTful Web services • XML services using just the HTTP protocol • Loosely coupled, message orientation • You’ll hear more about these later in the week
Expected Learning Outcomes • To understand the benefits provided by Web Services • To be able to compare Web Services with other Middleware technology • To understand the technologies at the core of Web Services