Professional Documents
Culture Documents
8 Sep 2008
8 Sep 2008
Bluffers guide
Web service (think a (code) library on the web)
A piece of software available over a network with a formal description of how it is called and what it returns that a computer can understand
An approach to web services that uses the existing infrastructure of the web An approach to web services that uses an XML-based messaging framework An XML description of a web service (normally SOAP) and how to interact with it
NVOSS 2008 - Web Services 8 Sep 2008 3
Attachments State
Asynchrony Messaging
8 Sep 2008
8 Sep 2008
REST by analogy
HTTP Method PUT GET POST Think CREATE Description Create a resource with the user specified id /proc analogy Start a new process Get the status of a process Amend a process
RETRIEVE Retrieve a resource representation UPDATE Update a resource/Append to a resource/Create a resource with a server assigned id Delete a resource
DELETE
DELETE
Kill a process
8 Sep 2008
HTTP GET is safe it does nothing else than retrieval HTTP GET, PUT and DELETE are idempotent the effects on the system of one or N identical requests are the same Consider HTTP GET with: Services which maintain idempotency whilst allowing parameterized URLs are accidentally RESTful 85% of web service traffic, 6x faster allegedly
NVOSS 2008 - Web Services 8 Sep 2008 8
http://processes.com/123/status http://processes.com/services?action=getStatus&pid=123
http://processes.com/services/action=cancelJob&pid=123
8 Sep 2008
What is SOAP?
Simple Object/Service-Oriented Access Protocol W3C specification
http://wanderingbarque.com/nonintersecting/2006/11/15/the -s-stands-for-simple/
http://www.w3.org/TR/soap
An XML-based messaging framework for exchanging information between peers in a decentralized, distributed environment Defines the message structure but not the message content (needs other technologies) Fundamentally stateless (no memory of what has happened previously) One-way message exchange paradigm
8 Sep 2008
10
SOAP body
8 Sep 2008
11
SOAP example
Request: <soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ComovingLineOfSight xmlns="http://skyservice.pha.jhu.edu"> <z>float</z> <hubble>float</hubble> <omega>float</omega> <lambda>float</lambda> </ComovingLineOfSight> </soap:Body> </soap:Envelope> Response: <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ComovingLineOfSightResponse xmlns=http://skyservice.pha.jhu.edu> <ComovingLineOfSightResult>float</ComovingLineOfSightResult> </ComovingLineOfSightResponse> </soap:Body> </soap:Envelope> NVOSS 2008 - Web Services 8 Sep 2008
12
What is WSDL?
Web Services Description Language W3C specification An XML grammar for describing the public interface of a web service in terms of:
its exposed operations the message formats protocol bindings (e.g. SOAP, HTTP) defines format of message content in the SOAP body http://www.w3.org/TR/wsdl
8 Sep 2008
13
Anatomy of a WSDL
<definitions> <types> <message> <portType> <operation> <input> <output> <fault> </operation> </portType> <binding> <service> </definitions>
A WSDL document describes: a set of services which exchange messages the data in the messages is defined in a set of types each message transfer in a service defines an operation operations have bindings to specific implementations using protocols like HTTP
8 Sep 2008
14
WSDL example
<definitions targetNamespace="http://skyservice.pha.jhu.edu" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s=http://www.w3.org/2001/XMLSchema xmlns:s0=http://skyservice.pha.jhu.edu xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http://skyservice.pha.jhu.edu"> <s:element name="ComovingLineOfSight> <s:element name="z" type="s:float" /> <s:element name="hubble" type="s:float" /> <s:element name="omega" type="s:float" /> <s:element name="lambda" type="s:float" /> </s:element> <s:element name="ComovingLineOfSightResponse> <s:element name="ComovingLineOfSightResult" type="s:float" /> </s:element> </s:schema> </types> <message name="ComovingLineOfSightSoapIn"> <part name="parameters" element="s0:ComovingLineOfSight" /> </message> <message name="ComovingLineOfSightSoapOut"> <part name="parameters" element="s0:ComovingLineOfSightResponse" /> </message> <portType name="DistanceSoap"> <operation name="ComovingLineOfSight"> <documentation>Return the comoving line of sight distance...</documentation> <input message="s0:ComovingLineOfSightSoapIn" /> <output message="s0:ComovingLineOfSightSoapOut" /> </operation> </portType> <service name="Distance> <port name="DistanceSoap" binding="s0:DistanceSoap> <soap:address location="http://voservices.net/Cosmology/ws_v1_0/Distance.asmx" /> </port> </service> </definitions> NVOSS 2008 - Web Services 8 Sep 2008 15
Alternate approach:
SOAP (and WSDL) are just XML Use XSLT, curl, JavaScript, etc.
8 Sep 2008
16
8 Sep 2008
17
Computing on demand:
Virtualization Providers:
Amazon EC2 Google Apps
Globus
http://www.globus.org
NVOSS 2008 - Web Services 8 Sep 2008 18
Beyond REST
Data event streams are the future of astronomy:
High volume Frequent Low latency
Hugh percentage of traffic with RESTful services is polling status SOAP is overly complicated The proposed solution: XMPP (PubSub)
Polling does not scale Not real time
8 Sep 2008
19
Jabber servers designed to handle at least 105 concurrent connections Sample message:
<iq type=set from=mjg@nvo.caltech.edu/events to=pubsub.nvocloud.edu id=mjg12345> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='/jobs/1234-5678-90AB-CDEF'> <job type=datadiscovery id=ivo://some.voevent/> </publish> </pubsub> </iq>
8 Sep 2008
20