Web Services
description
Transcript of Web Services
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 11
Web Services
Yih-Kuen Tsay
Dept. of Information Management
National Taiwan University
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 22
What Are Web Services?
• Modular applications accessible by standard protocols over the Internet
• Interfaces described by XML-based WSDL (Web Service Description Language)
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 33
General Process of Engaging a Web Service
Source: www.w3.org
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 44
Characteristics of Web Services
• Semantically encapsulated discrete functionality
• Loosely coupled, reusable components
• Programmatically accessible
• Distributed over the Internet
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 55
Web Services Architecture Stack
Source: www.w3.org
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 66
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)
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 77
• 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, ...
The Higher-Level Layers
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 88Source: Sun Microsystems, Inc.
Implementation Models of Web Services
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 99
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
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1010
Source: Sun Microsystems, Inc.
Core Structures of UDDI
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1111
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”
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1212Source: Sun Microsystems, Inc.
How WSDL Works
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1313
Discovery Process
Source: www.w3.org
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1414
A Service Brokering Architecture
Customer/Agent
WebServices
Registries
Web Service
Web Service
Web Service
Execution Engine
Ontologies
InferenceCache
InferenceModule
Inference EngineService Composer Service Annotator/Collector
ServiceDescriptions,
Provider/Service ProfilesInference
Module
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1515
• 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.
The JAX* Suite
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1616
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
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1717
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.
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1818
<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>
A SOAP Message
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 1919
Source: http://www.w3.org/TR/soap12-part1/
Composition of a SOAP Envelope
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 2020
<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>
A SOAP Envelope
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 2121
• 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>
SOAP Request and Response
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 2222
POST /StockQuote HTTP/1.1Host: www.example.orgContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "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>
SOAP Message in an HTTP Request
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 2323
POST /StockQuote HTTP/1.1HTTP/1.1 200 OKContent-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>
SOAP Message in an HTTP Response
IM NTUIM NTU
Distributed Information Systems Distributed Information Systems 20042004 Web ServicesWeb Services -- -- 2424Source: Sun Microsystems, Inc.
A SOAP Use Case