Presentation is loading. Please wait.

Presentation is loading. Please wait.

7 Sep 2006NVO Summer School 20061 T HE US N ATIONAL V IRTUAL O BSERVATORY Accessing Web Services Matthew J. Graham CACR/Caltech.

Similar presentations


Presentation on theme: "7 Sep 2006NVO Summer School 20061 T HE US N ATIONAL V IRTUAL O BSERVATORY Accessing Web Services Matthew J. Graham CACR/Caltech."— Presentation transcript:

1

2 7 Sep 2006NVO Summer School 20061 T HE US N ATIONAL V IRTUAL O BSERVATORY Accessing Web Services Matthew J. Graham CACR/Caltech

3 7 Sep 2006NVO Summer School 20062 Overview Definition of a web service Web service types Underlying technologies Usage models Federation 2.0

4 7 Sep 2006NVO Summer School 20063 Web service deoccultation Invocations Strange languages Action at a distance High priesthood

5 7 Sep 2006NVO Summer School 20064 What is a web service? A software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine- processable format. - W3C WSDL and SOAP conveyed using HTTP with an XML serialization + other Web-related standards Not a new idea: –RPC/RMI –CORBA –DCOM –XML-RPC

6 7 Sep 2006NVO Summer School 20065 Web service models - I Resource oriented model –A resource is anything that can have an identifier (URI) –Focuses on resource description and representation (data object reflecting state of resource) Service oriented model –A service is realised by an agent (provider) and used by another (requester) –Focuses on tasks (unit of action) that may be performed by an agent: description, messaging/choreography and goal state

7 7 Sep 2006NVO Summer School 20066 Web service models - II Message oriented model –A message is the basic unit of data sent from one agent to another: the action taken in response to receiving a message is up to the recipient –Focuses on message structure (contract) and transport (choice of protocol carries no semantics) Policy oriented model –A policy is a set of assertions expressing capabilities and constraints –Focuses on security, quality of service and management

8 7 Sep 2006NVO Summer School 20067 Hows it done in the real world? Things should be made as simple as possible, but no simpler - Albert Einstein WWW is the largest, most distributed and scalable application on the planet: –Objects (resources) are identified by URIs –Resource state information (representations) is exchanged in many data formats –Protocols that support interaction between agents and resources - choice of protocol places limits on which representation formats can be transmitted HTTP and HTML (XML)

9 7 Sep 2006NVO Summer School 20068 REST: The formal approach Architectural style not an implementation (http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_s tyle.htm) Each resource has a URI Exchange resource representations (XML) Uniform interface semantics (CRUD API): HTTP protocolCRUD actionDescription POSTCREATECreate a new resource GETRETRIEVERetrieve a resource representation PUTUPDATEUpdate a resource DELETEDELETEDelete a resource

10 7 Sep 2006NVO Summer School 20069 Accidentally RESTful HTTP GET/POST + XML (POX/HTTP) Verbs allowed in URIs Requires little new infrastructure - just HTTP and XML processing technologies Simple clients, e.g. wget or xsltproc Commercially popular (85% of traffic, 6x faster): –Amazon (http://www.amazon.com/gp/aws/landing.html) –Yahoo (http://developer.yahoo.net)http://developer.yahoo.net –eBay (http://developer.ebay.com/rest) –Flickr (http://www.flickr.com/services/)http://www.flickr.com/services/ –YouTube (http://www.youtube.com/api2_rest) –Del.icio.us (http://del.icio.us/doc/api)http://del.icio.us/doc/api

11 7 Sep 2006NVO Summer School 200610 AJAX (Asynchronous Javascript + XML) Uses browsers XML support: DOM, XSLT XMLHttpRequest Google Maps is best-known AJAX application

12 7 Sep 2006NVO Summer School 200611 Other data formats - I JSON (JavaScript Object Notation, RFC-4627) –Subset of JS object literal notation (does not require JS) –Data types: number, string, boolean, array, object, null –Supported by many languages –In Dec 2005, Yahoo! added support for JSON but –No schema mechanism (validation, code generation) –Limited type system (no date or time) –No extension or versioning

13 7 Sep 2006NVO Summer School 200612 Other data formats - II YAML (YAML Aint Markup Language) –All data can be represented by lists, hashes and scalars –Superset of JSON: validate with Kwalify –De facto serialization format in Ruby; support in many languages Microformats –Place marked up data in (X)HTML pages –Use HTML attributes: class, rel, and rev RSS/ATOM (RFC-4287) –Time-stamped uniquely-identified data chunks with metadata –Lucene Web Service API (http://dev.lucene-ws.net/wiki/API)http://dev.lucene-ws.net/wiki/API –Google Data (GData) API (http://code.google.com/apis/gdata/index.html)

14 7 Sep 2006NVO Summer School 200613 What do RESTful services lack? Format method for describing interface contract Reliable messaging Digital signatures Message routing Resource life cycle management Asynchronous event notification Other capabilities captured by WS-* specs

15 7 Sep 2006NVO Summer School 200614 What is SOAP? Simple Object/Service-Oriented Access Protocol (Snakes On A Plane?) An XML-based communication protocol and encoding format for exchanging structured information in a decentralized, distributed environment W3C specification (http://www.w3.org/TR/soap)

16 7 Sep 2006NVO Summer School 200615 Anatomy of a SOAP message An envelope to encapsulate data which defines formatting conventions for describing the message contents and routing directions: header and body A message exchange pattern: request/response (RPC mechanism), fire-and-forget A transport or binding protocol Data encoding rules for describing the mapping of application-defined datatypes into an XML tag-based representation

17 7 Sep 2006NVO Summer School 200616 SOAP example Request: http://www.w3.org/2001/XMLSchema-instancehttp://www.w3.org/2001/XMLSchema float float float float Response: float

18 7 Sep 2006NVO Summer School 200617 Client Invocation Models Static: use generated stubs: java org.apache.axis.wsdl.WSDL2Java Dynamic: –no generated code –a proxy dynamically generates a class at runtime that conforms to a particular interface, proxying all invocations to a single generic method –Examples: Java : use javax.xml.rpc.Service.getPort() and createCall().NET : use RealProxy class (must extend ContextBound) or Reflection.Emit Generic SOAP client: http://soapclient.com/soaptest.html

19 7 Sep 2006NVO Summer School 200618 Why is SOAP better? Asynchrony Routing Reliable messaging (e.g. once-and-only delivery, guaranteed or exact execution) Send and receive complex datatypes to invoke a particular method not just key-value pairs Security Binds to other protocols Service description

20 7 Sep 2006NVO Summer School 200619 Mashosphere: federating web services Mashup styles: –Presentation –Client-side data –Client-side software Mashup technologies (Rich Internet Applications): –Laszlo (http://openlaszlo.org) –Xforms (http://www.w3.org/MarkUp/Forms) –XUL (http://www.mozilla.org/projects/xul) –Dojo (http://dojotoolkit.org) –ATF (Open Ajax Alliance) – Server-side software – Server-side data

21 7 Sep 2006NVO Summer School 200620 SOA and WOA An application architecture within which all functions are defined using a description language as independent services with invokable interfaces which can be called in defined sequences to form business processes. Principles: –Service reusability –Service contract –Service loose coupling –Service abstraction Virtual Observatory = Service Oriented Astronomy WOA advocates REST or POX over HTTP – Service composability – Service autonomy – Service statelessness – Service discoverability

22 7 Sep 2006NVO Summer School 200621 WOA/Client Inclusive: web services means anything over HTTP Agnostic and Consistent: platform, technology, protocol, data format, contract description language, programming language Expect Constant Change: contract, protocol, endpoint Mashup-Oriented: integrating data from many sources and re-serving it Deeply Resilient: extreme fault tolerance, mandatory pessimism about quality of run-time environment (Web) Bare Data: transformation costs, lack of control Extreme Loose Coupling


Download ppt "7 Sep 2006NVO Summer School 20061 T HE US N ATIONAL V IRTUAL O BSERVATORY Accessing Web Services Matthew J. Graham CACR/Caltech."

Similar presentations


Ads by Google