260 likes | 412 Views
Web Services. What Are Web Services?. Semantically encapsulate discrete functionality Loosely coupled, reusable components Programmatically accessible Distributed over the Internet. A Web Services Technology Stack. *. **. * WSFL has been replaced by BPEL4WS.
E N D
What Are Web Services? • Semantically encapsulate discrete functionality • Loosely coupled, reusable components • Programmatically accessible • Distributed over the Internet Information Management NTU
A Web Services Technology Stack * ** * WSFL has been replaced by BPEL4WS. ** An alternative is ebXML (a UN/CEFACT standard for EDI-style information exchange). Information Management NTU Source: The Stencil Group
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) Information Management NTU
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, ... Information Management NTU
Implementation Models of Web Services Information Management NTU Source: Sun Microsystems, Inc.
A SOAP Use Case Information Management NTU Source: Sun Microsystems, Inc.
Core Structures of UDDI Information Management NTU Source: Sun Microsystems, Inc.
How WSDL Works Information Management NTU Source: Sun Microsystems, Inc.
How ebXML Works Information Management NTU Source: Sun Microsystems, Inc.
Web Services on .NET Information Management NTU Source: TheServerSide.com
Web Services on J2EE Information Management NTU Source: TheServerSide.com
Processing a Web Service Request Information Management NTU Source: TheServerSide.com
Registering/Discovering a Web Service Information Management NTU Source: TheServerSide.com
Messaging and RPC-Style Requests Information Management NTU Source: TheServerSide.com
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. Information Management NTU
Invoking Another Web Service Information Management NTU Source: TheServerSide.com
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 working draft Information Management NTU
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. Information Management NTU
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> Information Management NTU
Composition of a SOAP Envelope Information Management NTU Source: http://www.w3.org/TR/soap12-part1/
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> Information Management NTU
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> Information Management NTU
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> Information Management NTU
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> Information Management NTU
A SOAP Use Case Information Management NTU Source: Sun Microsystems, Inc.