360 likes | 490 Views
Web Services. Background Timeline Back to Data Semantic Web Web Services Representing Data Semantic Web Web Services Service Orientation A Web Service!. Know this Man?. Tim Berners-Lee. Inventor of the WWW. Timeline. 1991 – first website (CERN HTTPd )
E N D
Web Services • Background • Timeline • Back to Data • Semantic Web • Web Services • Representing Data • Semantic Web • Web Services • Service Orientation • A Web Service!
Know this Man? Tim Berners-Lee Inventor of the WWW
Timeline 1991 – first website (CERN HTTPd) http://info.cern.ch/hypertext/WWW/TheProject.html
1998 • XML becomes a W3C recommendation • WDDX (Web Distributed Data eXchange) • XML-RPC M$, Don Box, Dave Winer, et al • SOAP M$, Don Box – Dave Winer, et al • 1999 • Resource Description Framework (RDF) v1 becomes a W3C recommendation • 2001 • Dot-com bubble bursts
2002 • Tim Berners Lee: “As we look forward, we are tempted to distinguish between the multimedia world of information targeted for human perception, and the well-defined world of data which machines handle....” • Tim Berners Lee: “The Web technology must allow information intended for a human to be effectively presented, and also allow machine processable data to be conveyed. Only then can we start to use computers as tools again” • 2003 • SOAP becomes a W3C recommendation • 2004 • Web 2.0 term coined • RDF v2 published • 2001 – 2007 • SOAP vs REST wars
Next generation of the Web = machine-processableinformation Machine-to-Machine Web Data exported as Web pages
Web Services • Companies needed standard mechanisms to be able to • Publish • Advertise • Discover • And a security model links toapplications, rather than web pages No good for business of security scraping web pages Hence XML-RPC -> SOAP
Sidebar: HTML and XML • Derivatives of Standard Generalized Markup Language (SGML). • Offer machine readable, yet machine independent means of conveying information • Use the angle bracket syntax (<>) to structure the document. • Based on a tree-structure: root <html> <head> </head> <body> <p> hello world </p> </body> </html> child siblings
Hypertext Markup Language (HTML) • Its primary purpose is to convey presentational information to a browser: • <p>, <bold>, <italic>, <pre> etc. • It does contain other tags that are not presentational. • Like one for metadata: • <meta> • And ones that are structural: • e.g. <head>, <body>, <div>, <span> • And some that are sort of in between: • e.g. , <ol>, <ul>, <h1>, <title> • HTML can embed information: • e.g. <img>, <object> • It can also contain style and script content in the header: • <style>, <script> • Most importantly, it can link to other resources via the href attribute: • e.g. <a href=“http:// example.com/otherpage.html”>
HTML • HTML Example describing a book <h1>The Cat in the Hat</h1><br> <p>by Dr Seuss</p> <ul> <li>Publisher: HarperCollins</li> <li>Genre: Children’s Fiction</li> <li>Year: 2003</li> <li>ISBN: 0-00-715853</li> </ul> <br>visit the website <a href=“http://harp.co.uk”>here</a>
HTML • The main limitations of HTML are: • Fixed set of tags • Focus on presentation • Like the Web, it is primarily for human consumption • Not all HTML is ‘well-formed’, i.e. it breaks the tree structure • The classic case is orphan <br> tags. Strictly speaking, a tag must either contain child tags, or be an empty tag (<br/>). • During the browser wars mostly between M$ and Netscape, browsers became very forgiving of invalid markup to recruit users. • This is just about OK when dealing with a fixed set of presentational tags, free market economics permitting • But not sustainable and not good for machine parsing
Extensible Markup Language (XML) • XML is (e)xtensible. • You can create your own tags which means • Tags can be semantic: • e.g. <book> contains <author> • XML MUST be well-formed (no structural inconsistencies like <br>) • validation against a Document Type Definition (DTD) or XML Schema or NG-Relax document is easier because it is well-formed. • These define what a particular document can contain, e.g. a book element MUST contain >= 1 author elements
XML • XML Example of a book <?xml version="1.0"?> <book> <title>The Cat in the Hat</title> <author>Dr Seuss</author> <isbn>0-00-715853<isbn> <genre>Children’s Fiction</genre> <published>2003</published> <publisher> <name>HarperCollins</name> <url>http://harp.co.uk</url> </publisher> </book>
XML Pros • Plain text • Human readable • Create/edit in standard text editor (if you really want to) • Self-Describing, Structured Data • Extensible tag language • Machine readable • Can be validated against DTDs and Schema • Presentation independent • Unlike HTML • Format to other languages using transformations (e.g. XSLT) • Programming language independent • Java, C, C++, Visual Basic, Perl… • Simple to parse • Widely used in many domains and for many purposes
XML Cons • The main limitations of XML are: • Verbose way of describing data • How do you include binary data (e.g. images)? • (work in progress and not ubiquitously supported) • A proliferation of DTD and Schema types because anyone can create their own tags • Lots of processing time for each new XML doc and DTD/Schema you come across • New software components to understand the new XML docs (their semantics not structure) • How do I know if your <author> tag means the same as my <author> tag?
XML Namespaces <a:author xmlns:a=“http://andrew/namespace”> • This last issue is addressed through namespaces • Allows a tag to be qualified by a URI: <s:author xmlns:s=“http://sue/namespace”> prefix binding namespace • Now I can tell the difference between the two author tags :-) • But the XML is more complicated :-( • And what happens if I change the definition of my author tag? • I suppose I better change the namespace: <a:author xmlns:a=“http://andrew/namespace/v1”> • That’s better :-) • But now every client that understood the previous namespace is broken :-(
Exchanging Data This focus on representing and exchanging data using XML led to two main development thrusts: • The Semantic Web: an extension of the current World Wide Web (Resource Oriented) in which information is given well-defined meaning, better enabling computers and people to work in cooperation. • focused on the representation of data • seeks to create a machine processable Web. • led by W3C + large number of researchers and industrial partners. • based on the Resource Description Framework (RDF) • A Web Service: a software system designed to support interoperable machine-to-machine interaction over a network (Service Oriented) • They provide the definitions (and infrastructure) to allow applications to remotely exchange XML messages with each other.
Semantic Web & Web Services • Complement each other: • Web Services meet immediate technology needs • Semantic Web is still growing
Semantic Web • Based on RDF • subject, object, predicate • classification of resources and properties is called an ontology • example: FOAF • Dave knows Sally • Allows you to create graphs based on the knows predicate which model more information than is present in an individual person
RDF XML <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <foaf:Personrdf:about="#AL"> <foaf:name>Archibald Leach</foaf:name> <foaf:mbox_sha1sum>cf2342293...</foaf:mbox_sha1sum> <foaf:knows> <foaf:Person> <foaf:name>Katharine Hepburn</foaf:name> </foaf:Person> </foaf:knows> </foaf:Person> </rdf:RDF>
FOAF visualized Timothy M. O'Brien Aug. 21, 2005
OWL • Web Ontology Language (OWL) • extends RDF • Supports reasoning over resources • via classes, class hierarchies • axioms – restrictions on class properties and their relationships with other classes • A cat is an animal; Felix is a cat; Therefore Felix is an animal • also (disjoint) constraints
Semantic Web • Hasn’t taken off in a big way - yet • Why? • concepts are quite heavy • RDF XML is ugly • requires taxonomies (ontologies) and agreement between them • very different from folksonomies • But history doesn’t stop. More and more people are becoming interested in it • HTML5+RDFa
Remember Object Orientation andResource Orientation? • In Object Oriented distributed systems an application has the concept of a remote object that receives messages. • An object has lifetime (you can create it and destroy it). • It encapsulated State and operations on that state. • Examples: Jini, CORBA, DCOM, Legion • In Resource Oriented systems, applications support the concept of resources • They are accessible via different protocols. • They have state, but no operations on that state. • Operations are defined by the access protocol. • The example: the Web • Web Services are used to create Service Oriented Architectures • These are service oriented • What is Service Orientation?
Service Orientation • Service Orientation is an attempt to make distributed systems more loosely coupled • In Object Orientation an object maintains data, and operations for accessing/manipulating that data. • State and operations are combined into single entity - think BankAccount.java • In Service Orientation state and the operations on it are separated • A service is an interface to something with state, but we don’t know and don’t care what that thing is. • All we see is the service interface which defines activities. • The Service interface provides operations on the state but doesnot have state in itself.
Benefits of Service Orientation • A service does not have state, so I don’t have to worry about lifetime issues • The service interface is typically defined as a contract • The contract describes the messages received and sent by the service. • Each message contains everything the service needs to know to perform its task - nothing is implied through ‘shared knowledge’. • So I don’t have to ‘know’ what sort of thing it is, or what classes it inherits from like I do with objects. Instead, I can interpret the contract at runtime and communicate with the service immediately. • Service interfaces are usually coarse-grained • The lack of state in services and the fact that messages contain all necessary information means many interactions can be idempotent • They have no side-effects if they are repeated. - I send a message, wait… get no response, so send it again without worrying that I have induced an inconsistent state at the server side. • Easy to swap over/replicate services if they have the same interface
Objects and Resources resource object data data representation operations operations Access protocol
Objects, Resources and Services data object service resource data data operations operations operations Access protocol
XML XML Ok, What is a Web Service? Message • Web services are software programs that enable remote applications to talk to each other via XML messages. Message A program sends amessage to a remote Web service containing an XML message and (optionally) receives amessage.
Web Services Technologies • 3 Main Components • SOAP: envelope for wrapping and transporting data. • WSDL: the web service interface i.e. its description • UDDI: the repository i.e. the yellow pages of where you find information (e.g. like Jini LUS)
XML XML Web Service Structure Request Envelope (SOAP) Language Specific e.g. C++ Language Specific e.g. Java SOAP processor XML WSDL interface XML WSDL interface SOAP processor Response Envelope (SOAP) • the implementation is independent of its interface
Web Services Technologies • 3 Main Components • SOAP: envelope for wrapping and transporting data. • WSDL: the web service interface i.e. its description • UDDI: the repository i.e. the yellow pages of where you find information (e.g. like Jini LUS) • PLUS: Data and Metadata
The Devil in the Detail • So far, so simple • But to describe all data AND metadata (security, policy, atomic transactions etc) is pretty hard. • And remember – each service can specify its own interface • For data XMLSchema are typically used. • XML Syntax for describing data in XML • Basic primitives • Simple Types • Compound types • Abstract Types • Inheritance (extension, restriction) • For metadata…