1 / 23

Introduction to Web Services Technology

T HE US N ATIONAL V IRTUAL O BSERVATORY. Introduction to Web Services Technology. Matthew J. Graham CACR/Caltech. Overview. SOA SOAP, WSDL and UDDI Infrastructures: AXIS, .Net (Mono), Python, Perl, PHP Invocation Interoperability

nicki
Télécharger la présentation

Introduction to Web Services Technology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. THE US NATIONAL VIRTUAL OBSERVATORY Introduction to Web Services Technology Matthew J. Graham CACR/Caltech NVO Summer School

  2. Overview • SOA • SOAP, WSDL and UDDI • Infrastructures: AXIS, .Net (Mono), Python, Perl, PHP • Invocation • Interoperability • Emerging topics: attachments, state, security, asynchronous NVO Summer School

  3. Service Oriented Astronomy • An application architecture within which all functions are defined as independent services with well-defined invocable interfaces which can be called in defined sequences to form scientific processes. • Web Services are animplementation NVO Summer School

  4. Technological challenges • WS technologies need to address four basic challenges: • Service Description • Service Implementation • Service Publishing, Discovery and Binding • Service Invocation and Execution NVO Summer School

  5. What’s wrong with HTTP GET? • “Things should be made as simple as possible, but no simpler” - Albert Einstein • Highly scalable, predominantly read-only data • REST (Representational State Transfer) • Amazon.com: • has both REST and SOAP APIs • 85% of requests are REST • REST response is 6 times faster than SOAP NVO Summer School

  6. Why is SOAP better? • Send and receive complex datatypes to invoke a particular method not just key-value pairs • Security - not URI parameters • Guaranteed or exact execution • Binds to other protocols NVO Summer School

  7. What is SOAP? • Simple Object Access Protocol • 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) NVO Summer School

  8. Anatomy of a SOAP message • An envelope to encapsulate data which defines formatting conventions for describing the message contents and routing directions • A request/response message exchange pattern (RPC mechanism) • A transport or binding protocol • Data encoding rules for describing the mapping of application-defined datatypes into an XML tag-based representation NVO Summer School

  9. 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> NVO Summer School

  10. What is WSDL? • Web Services Description Language • An XML grammar for describing a web service as a collection of endpoints capable of exchanging messages in a particular fashion • W3C specification (http://www.w3.org/TR/wsdl) NVO Summer School

  11. Anatomy of a WSDL file - include other WSDLS - define datatypes used in <message> elements - model data exchanged - a subset of operations supported for an endpoint - define input and output messages - concrete protocol and data format specification for a <portType> element - identifies actual endpoint for WS <definitions> <import>* <types> <schema></schema>* </types> <message>* <part></part>* </message> <portType>* <operation>* <input></input> <output></output> <fault></fault>* </operation> </portType> <binding>* <operation>* <input></input> <output></output> </operation> </binding> <service>* <port></port>* </service> </definitions> NVO Summer School

  12. WSDL example (I) <?xml version="1.0" encoding="utf-8"?> <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://skyservice.pha.jhu.edu" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="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:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="z" type="s:float" /> <s:element minOccurs="1" maxOccurs="1" name="hubble" type="s:float" /> <s:element minOccurs="1" maxOccurs="1" name="omega" type="s:float" /> <s:element minOccurs="1" maxOccurs="1" name="lambda" type="s:float" /> </s:sequence> </s:complexType> </s:element> <s:element name="ComovingLineOfSightResponse"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="ComovingLineOfSightResult" type="s:float" /> </s:sequence> </s:complexType> </s:element> </s:schema> </types> NVO Summer School

  13. WSDL example (II) <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> <binding name="DistanceSoap" type="s0:DistanceSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="ComovingLineOfSight”> <soap:operation soapAction="http://skyservice.pha.jhu.edu/ComovingLineOfSight" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="Distance"> <documentation>...</documentation> <port name="DistanceSoap" binding="s0:DistanceSoap"> <soap:address location="http://voservices.net/Cosmology/ws_v1_0/Distance.asmx" /> </port> </service> </definitions> NVO Summer School

  14. WSDL binding flavours (I) RPC Document • <message name=“Request”> • <part name=“x” type=“xs:int”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType> • <types> • <schema> • <element name=“xElement” type=“xs:int”/> • </schema> • </types> • <message name=“Request”> • <part name=“x” element=“xElement”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType> Literal • <message name=“Request”> • <part name=“x” type=“xs:int”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType> Encoding NVO Summer School

  15. WSDL binding flavours (II) RPC Document • <soap:envelope> • <soap:body> • <method> • <x>5</x> • </method> • </soap:body> • </soap:envelope> • <soap:envelope> • <soap:body> • <xElement>5</xElement> • </soap:body> • </soap:envelope> Literal • <soap:envelope> • <soap:body> • <method> • <x xsi:type=“xs:int”>5</x> • </method> • </soap:body> • </soap:envelope> Encoding NVO Summer School

  16. WSDL binding flavours (III) Document/literal wrapped • <types> • <schema> • <element name=“method”> • <complexType> • <sequence> • <element name=“x” type=“xs:int”/> • </sequence> • </complexType> • </element> • </schema> • </types> • <message name=“Request”> • <part name=“parameters” element=“method”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType • <soap:envelope> • <soap:body> • <method> • <x>5</x> • </method>> • </soap:body> • </soap:envelope> NVO Summer School

  17. UDDI • Universal Description, Discovery and Integration • A platform-independent, open framework for publishing and discovering information about web services • OASIS specification (http://www.uddi.org) NVO Summer School

  18. What do I need? • SOAP library • WSDL parser • Client and server stub code generator • Service container • (UDDI library) NVO Summer School

  19. What’s available? • Java (http://www.javaskyline.com/webservices): • Axis (http://ws.apache.org/axis) • Globus (http://www.globus.org) • C#: • .Net; Mono (http://www.go-mono.com) • OGSI.NET / WSRF.NET (http://www.cs.virginia.edu/~gsw2c/wsrf.net.html) • Perl: • SOAP::Lite (http://www.soaplite.com) • OGSI::Lite / WSRF::Lite (http://www.sve.man.ac.uk/Research/AtoZ/ILCT) • Python: • SOAPpy / ZSI (http://pywebsvcs.sourceforge.net) • Twisted (http://www.twistedmatrix.com/products/twisted) • PyGlobus/PyGridWare • PHP • NuSOAP (http://dietrich.ganx4.com/nusoap) • XForms (http://www.w3.org/MarkUp/Forms) NVO Summer School

  20. Client Invocation Models • Static: use generated stubs • 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 • standard Java : use javax.xml.rpc.Service.getPort() and createCall() • .Net : use RealProxy class (must extend ContextBound) or Reflection.Emit NVO Summer School

  21. Interoperability • Suitable for and capable of being implemented in a neutral manner on multiple operating systems and in multiple programming languages • Not all web services are interoperable! • Web Services Interoperability Organisation (http://www.ws-i.org) • WS-I Testing Tools NVO Summer School

  22. Emerging technologies • Attachments: • DIME vs. MTOM (http://www.w3.org/TR/soap12-mtom) • Security: • WS-Security (http://www-106.ibm.com/developerworks/webservices/library/ws-secure) • WSS4J? • State: • WSRF (http://www.globus.org/wsrf) • Asynchronous: • WS-CAF (http://www.arjuna.com/standards/ws-caf”) • WSRF NVO Summer School

  23. Conclusions • Make sure a web service is the best solution to an application requirement • Focus on the WSDL • Use your favourite language and platform • Interoperability is a great idea • Be aware of emerging and converging technologies NVO Summer School

More Related