Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services © 2015University of Greenwich 1 A Gentle Introduction to Web Services Dr Kevin McManus Adapted from material by Mark Sapossnek, Boston University,

Similar presentations


Presentation on theme: "Web Services © 2015University of Greenwich 1 A Gentle Introduction to Web Services Dr Kevin McManus Adapted from material by Mark Sapossnek, Boston University,"— Presentation transcript:

1 Web Services © 2015University of Greenwich 1 A Gentle Introduction to Web Services Dr Kevin McManus Adapted from material by Mark Sapossnek, Boston University, Gill Windall, University of Greenwich and no doubt others

2 Web Services © 2015University of Greenwich 2 Rationale Revision of HTTP fundamentals Introducing XML Web services SOAP and REST (POX)

3 Web Services © 2015University of Greenwich 3 WWW Architecture Request: http://w3.foo.org/bar/q.php Response: … Platform: PC, Mac, *nix, Android, etc. Web Browser: IE, Mozilla, Opera, etc. Client Platform: PC, Mac, *nix, etc. Web Server: Apache, IIS, Nginx, etc. Server Network HTTP over TCP/IP

4 Web Services © 2015University of Greenwich 4 WWW Architecture Client/Server, Request/Response architecture Client requests a resource HTTP request e.g http://w3.foo.org/bar/q.php?name=Leon&pie=apple The web server responds with data HTTP response usually in the form of a web page an HTML document could be any file format Web pages are identified by a Uniform Resource Locator (URL) globally unique protocol: e.g. http web server: e.g. w3.foo.org [machine name].[domain name] resource: e.g. bar/q.php can also provide get data: e.g. ?name=Leon&pie=apple and POST data, and cookie data

5 Web Services © 2015University of Greenwich 5 HyperText Transport Protocol HTTP HTTP is the principle top-level TCP/IP protocol used to request and return data in Web applications data may be a static file on the web server HTML pages, GIFs, JPEGs, PDF documents, XML files, etc., etc. data may result from running some program on the web server PHP, CGI, ASP, JSP, etc., etc. Request-Response protocol Methods: GET, POST, … Stateless HTTP 1.0: simple – why? HTTP 1.1: slightly more complex – why?

6 Web Services © 2015University of Greenwich 6 GET /default.php HTTP/1.0 Accept: image/gif, image/x-bitmap, image/jpeg, */* Accept-Language: en User-Agent: Mozilla/1.22 (compatible; MSIE 2.0; Windows 95) Connection: Keep-Alive If-Modified-Since: Sunday, 17-Apr-96 04:32:58 GMT HTTP Request Method File (Resource) HTTP version Headers POST Data – none for GET Blank line

7 Web Services © 2015University of Greenwich 7 HTTP/1.0 200 OK Date: Sun, 21 Apr 1996 02:20:42 GMT Server: Microsoft-Internet-Information-Server/5.0 Connection: keep-alive Content-Type: text/html Last-Modified: Thu, 18 Apr 1996 17:39:05 GMT Content-Length: 2543... HTTP Response HTTP versionStatus codeReason phrase Headers Data

8 Web Services © 2015University of Greenwich 8 Extensible Markup Language XML A subset of the Standard Generalized Markup Language (SGML ISO 8876 1986) for documents why? A meta-language - extensible a language for defining other languages e.g. XHTML, SVG, MathML, RDF, RSS, XSLT, SOAP, WSDL Represents hierarchical data tree structure easy for humans and machines to work with Useful for data exchange and transformation W3C standard Separates of content from presentation Enabling technology for web services and the semantic web

9 Web Services © 2015University of Greenwich 9 XML Basics XML is designed to represent and transfer structured data In HTML: 12 Jan 2015 In XML: 12 Jan 2015 XML does not display or transform data XML separates data from formatting and transforming HTML and XML are both derived from SGML in different ways inherited some useful legacy

10 Web Services © 2015University of Greenwich 10 XML Syntax XML is composed of tags and attributes tags can be nested representing entities, entity properties and entity hierarchy …

11 Web Services © 2015University of Greenwich 11 XML Syntax 1.Document has a single root element 2.Tags must be properly nested no overlapping tag pairs 3.All tags must have a closing tag or be self closing 4.Tag names are case sensitive 5.Tag attributes are in the opening tag unique attribute name attribute value must be quoted Rules 1 and 2 mean that the structure of an XML document must be a hierarchical tree

12 Web Services © 2015University of Greenwich 12 XML Schemas XML languages can be defined using schemas: Document Type Definition - DTD SGML technology XML Schema Definition - XSD XML technology Both DTD and XSD define: vocabulary the tags and attributes grammar constraints on the tags, attributes and their values XML schemas describe the structure of an XML document Both enable automated validation of XML DTD and XSD are mutually exclusive

13 Web Services © 2015University of Greenwich 13 Web Services web pages the web (HTTP) client objectserver object LAN or WAN client objectserver object the web HTTP + XML take this idea and add… distributed object systems, e.g. DCOM, RMI, CORBA … results in XML based web services

14 Web Services © 2015University of Greenwich 14 Web Services Evolution of the Web Generation 1 Static HTML HTML Generation 2 Web Applications HTML XML Generation 3 Web Services HTML, XML

15 Web Services © 2015University of Greenwich 15 Fiefdoms and Emissaries Want to insure their car Price Comparison Site Red Flag Insurance Sandcastle Insurance Cromwell Insurance Apologies to Pat Helland and Roger Sessions

16 Web Services © 2015University of Greenwich 16 Service Oriented Example Brokering application HTML HTTP share price service XML HTTP currency conversion service XML HTTP authentication service XML HTT P

17 Web Services © 2015University of Greenwich 17 What is a Web Service? A URL that returns structured data text formatted - why? usually XML or JSON or name=value or CSV Web Services combine the best features of distributed computing and eliminate the worst provides a mechanism for invoking methods remotely passing arguments and returning data using existing Web standards i.e. HTTP and XML considered scalable and safe allowed through corporate firewall unlike previous distribution technologies

18 Web Services © 2015University of Greenwich 18 Web Services Allow you (the software developer) to develop applications that make use of components anywhere on the Web as long as they are published as Web Services service consumer or client Allow you (the software developer) to publish applications that you create as Web Services that can be used by other developers as components of their applications service provider or publisher

19 Web Services © 2015University of Greenwich 19 What is a Web Service? The solution for distributed computing? A Web Service exposes functionality to a service consumer over the Internet or intranet a programmable URL functions that can be called over the Internet Based on Web standards HTTP, XML, SOAP, WSDL, UDDI and more Language and platform agnostic can be implemented in any language on any platform Black boxes reusable components

20 Web Services © 2015University of Greenwich 20 What is a Web Service? Web Services allow you to interconnect different applications devices organisations fiefdoms clients not just browsers Allows simple staightforward distribution and integration of application logic Enables the programmable Web not just the purely interactive Web Web Services are loosely coupled why is this a good thing?

21 Web Services © 2015University of Greenwich 21 Web Services The concept of web services is not necessarily tied to any specific technology Three technologies frequently mentioned in connection with web services are: SOAP (Simple Object Access Protocol) an XML based protocol for exchanging information developed by Microsoft but now under the wing of W3C very wide industry backing WSDL (Web Services Description Language) an XML based language for describing web services and how to access them UDDI (Universal Description, Discovery and Integration) a method for publishing and finding web service descriptions And then there is REST (POX)

22 Web Services © 2015University of Greenwich 22 SOAP Originally developed by Microsoft as a Simple Object Access Protocol circa 1998 adopted by W3C who now maintain the standard A lightweight XML protocol for exchanging information in a distributed, heterogeneous environment Interoperable OS, object model & programming language neutral provides type definitions hardware independent protocol independent Operates over the existing Internet infrastructure HTTP transport

23 Web Services © 2015University of Greenwich 23 SOAP Guiding principle: “Invent no new technology” Builds on key Internet standards SOAP ≈ HTTP + XML The SOAP specification defines: the SOAP message format how to send messages how to receive responses data encoding

24 Web Services © 2015University of Greenwich 24 SOAP SOAP requests are HTTP POST requests POST /WebCalculator/Calculator.asmx HTTP/1.1 Content-Type: text/xml SOAPAction: "http://tempuri.org/Add" Content-Length: 386...

25 Web Services © 2015University of Greenwich 25 SOAP SOAP Message SOAP Envelope SOAP Header SOAP Body Message Name & Data Headers XML-encoded SOAP message name & data contains SOAP message name Individual headers encloses headers encloses payload Protocol binding headers The complete SOAP message

26 Web Services © 2015University of Greenwich 26 SOAP Message Format XML document using the SOAP schema... 12.44 26.13

27 Web Services © 2015University of Greenwich 27 SOAP Server Response Server responds with a result message HTTP/1.1 200 OK... Content-Type:text/xml Content-Length: 391 38.57

28 Web Services © 2015University of Greenwich 28 Encoding Complex Data Data structures are serialized as XML Plastic Novelties Ltd 129 PLAS

29 Web Services © 2015University of Greenwich 29 WSDL Web Services Description Language WSDL 1.1 standardised by W3C in 2001 XML schema for describing Web Services 1.Service interface definition abstract semantics for the Web Service 2.Service implementation definition concrete end points and network addresses where the Web Service can be invoked WSDL 2.0 is a 2007 W3C recommendation still!

30 Web Services © 2015University of Greenwich 30 UDDI Universal Description, Discovery, and Integration Open industry initiative to address discovery a registration database for Web Services white, yellow and green pages An OASIS standard Organization for the Advancement of Structured Information Standards schema for service providers and descriptions API for publishing and searching developed on industry standards (XML, HTTP, TCP/IP, SOAP) applies to both XML and non-XML services

31 Web Services © 2015University of Greenwich 31 REST Representational State Transfer † Originally referred to a collection of architectural principles: A stateless client/server protocol HTTP A set of well-defined operations GET, POST, DELETE A universal syntax for resource-identification URL The use of hypermedia HTML, XML Simply a URL that returns XML Plain Old XML (POX) or any structured data † Fielding, R T (2000) Architectural Styles and the Design of Network-based Software Architectures, PhD Dissertation University of California, Irvine, Ch. 5

32 Web Services © 2015University of Greenwich 32 Web Service Summary A new(ish) paradigm for Internet and Web development Provide and consume applications as services using existing web technologies Third-generation Internet n-tier systems At the heart of just about everything Enabling technology for the semantic web "This simple idea... remains largely unrealized" † † Shadbolt, N, Hall, W, Berners-Lee, T (2006) The Semantic Web Revisited, IEEE Intelligent Systems

33 Web Services © 2015University of Greenwich 33 Questions?


Download ppt "Web Services © 2015University of Greenwich 1 A Gentle Introduction to Web Services Dr Kevin McManus Adapted from material by Mark Sapossnek, Boston University,"

Similar presentations


Ads by Google