240 likes | 323 Views
Web Services. Yih-Kuen Tsay Dept. of Information Management National Taiwan University. What Are Web Services?. Modular applications accessible by standard protocols over the Internet Interfaces described by XML-based WSDL (Web Service Description Language).
E N D
Web Services Yih-Kuen Tsay Dept. of Information Management National Taiwan University Web Services -- 1
What Are Web Services? • Modular applications accessible by standard protocols over the Internet • Interfaces described by XML-based WSDL (Web Service Description Language) Web Services -- 2
General Process of Engaging a Web Service Web Services -- 3 Source: www.w3.org
Characteristics of Web Services • Semantically encapsulated discrete functionality • Loosely coupled, reusable components • Programmatically accessible • Distributed over the Internet Web Services -- 4
Web Services Architecture Stack Web Services -- 5 Source: www.w3.org
The Core Layers • Common Internet Protocols (HTTP, HTTPS, SMTP, …): the basic communication framework for Web services • XML: a widely accepted format for exchanging data and its corresponding semantics • SOAP: an XML-based protocol for messaging and RPC-style communication between applications (in a distributed environment) Web Services -- 6
The Higher-Level Layers • WSDL: an XML-based description of how to connect to a particular Web service • UDDI: a set of protocols and a public directory for registration and real-time lookup of Web services • BPEL4WS: a framework for defining new business processes that utilize existing web services. * ebXML: defines core components, business processes, registry and repository, messaging services, ... Web Services -- 7
Implementation Models of Web Services Web Services -- 8 Source: Sun Microsystems, Inc.
UDDI Registries • White pages: information about a service provider • business name, text description, contact information, ... • Yellow pages: business categories • NAICS, UN/SPSC, Geographical Information, … • Green pages: information that describes how to work with someone • business processes, service descriptions, binding information, … Source: www-3.ibm.com Web Services -- 9
Core Structures of UDDI Source: Sun Microsystems, Inc. Web Services -- 10
TModels in UDDI • Categories & Identifiers • Categorization and identification taxonomies are tModels • Categories and identifiers are tModel Instances • WSDL Port Types and Services • WSDL port types are tModels • WSDL services that are bound to a port type are tModel instances * TModels represent the extent of UDDI’s semantic description capabilities. Source: adapted from “www.semanticweb.org/SWWS/program/jamessnell.ppt” Web Services -- 11
How WSDL Works Web Services -- 12 Source: Sun Microsystems, Inc.
Discovery Process Web Services -- 13 Source: www.w3.org
A Service Brokering Architecture Web Services -- 14
The JAX* Suite • JAXR (Java API for XML Registries): to look up the business partner's web service. • JAX/RPC (Java API for XML RPC): to send RPC requests to external web services. • JAXM (Java API for XML Messaging): to send SOAP/ebXML messages to external web service. • JAXP (Java API for XML Parsing) and JAXB (Java API for XML Binding): to transform Java data into an XML format and to convert the received XML data back into a Java language construct, and to perform XSLT transforms to convert schemas. Web Services -- 15
Simple Object Access Protocol(SOAP) • For information exchange in a distributed environment • Message format based on XML • Can be combined with various transport protocols • Originally developed by Microsoft • SOAP Version 1.2 now a W3C recommendaton Web Services -- 16
Parts of SOAP • The SOAP envelope: for describing what is in a message and how to process it. • The SOAP binding framework (added in Version 1.2): for exchanging SOAP envelopes between peers using an underlying transport protocol • The SOAP encoding rules: for exchanging instances of application-defined data types. • The SOAP RPC representation: a convention for representing remote procedure calls and responses. Web Services -- 17
A SOAP Message <env:Envelope xmlns:env="http://www.w3.org/2001/09/soap-envelope"> <env:Header> <n:alertcontrol xmlns:n="http://example.org/alertcontrol"> <n:priority>1</n:priority> <n:expires>2001-06-22T14:00:00-05:00</n:expires> </n:alertcontrol> </env:Header> <env:Body> <m:alert xmlns:m="http://example.org/alert"> <m:msg>Pick up Mary at school at 2pm</m:msg> </m:alert> </env:Body> </env:Envelope> Web Services -- 18
Composition of a SOAP Envelope Source: http://www.w3.org/TR/soap12-part1/ Web Services -- 19
A SOAP Envelope <env: Envelope xmlns:env="http://www.w3.org/2001/09/soap-envelope/" env:encodingStyle="http://www.w3.org/2001/09/soap-encoding/"> <env:Header> <t:Transaction xmlns:t="some-URI"> env:mustUnderstand="1" 5 </t:Transaction> </env:Header> <env:Body> <m:GetLastTradePrice xmlns:m="some-URI"> <symbol>DEF</Symbol> </m: GetLastTradePrice> </env:Body> </env : Envelope> Web Services -- 20
SOAP Request and Response • Request (partial) <env:Body> <m:GetLastTradePrice xmlns:m="some-URI"> <symbol>DEF</symbol> </m:GetLastTradePrice> </env:Body> • Response (partial) <env:Body> <m:GetLastTradePriceResponse xmlns:m="some-URI"> <price>22.50</price> </m: GetLastTradePriceResponse> </env:Body> Web Services -- 21
SOAP Message in an HTTP Request POST /StockQuote HTTP/1.1 Host: www.example.org Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "http://example.org/2001/06/quotes" <env:Envelope xmlns:env="http://www.w3.org/2001/09/soap-envelope" > <env:Body> <m:GetLastTradePrice env:encodingStyle="http://www.w3.org/2001/09/soap-encoding" xmlns:m="http://example.org/2001/06/quotes"> <symbol>DIS</symbol> </m:GetLastTradePrice> </env:Body> </env:Envelope> Web Services -- 22
SOAP Message in an HTTP Response POST /StockQuote HTTP/1.1 HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn <env:Envelope xmlns:env="http://www.w3.org/2001/09/soap-envelope" > <env:Body> <m:GetLastTradePriceResponse env:encodingStyle="http://www.w3.org/2001/09/soap-encoding" xmlns:m="http://example.org/2001/06/quotes"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </env:Body> </env:Envelope> Web Services -- 23
A SOAP Use Case Web Services -- 24 Source: Sun Microsystems, Inc.