Enterprise Computing:Web Services
Exercise
What is wrong with JEE?
Why would you not use it for web-based application integration?
Why would you not use it for intranet-based application integration?
2
3
Web Services: Definitions
A Web service is a collection of functions that are packaged as a single entity and published to the network for use by other programs.
Web services are building blocks for creating open distributed systems, and allow companies and individuals to quickly and cheaply make their digital assets available worldwide.
Web Service standards form a platform-independent, open framework for describing services, discovering businesses, and integrating business services.
4
eXtensible Markup Language
A common data format derived from SGML Language independent, hierarchical and self-describing Uses tag-based structure similar to HTML to define XML
documents<?xml version="1.0" encoding="ISO-8859-1" ?> <bankaccount type=“Current”> <name>John Smith</name> <address>
<line 1>1 Grafton Street </line1><line 2>Dublin 2, Ireland </line2></address>
</bankaccount>
Supports arbitrarily complex data formats Schema (defined in xsd files) can be used to define document
formats Fragment defining a BankAccount as a type of financial record
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
5
eXtensible Markup Language
Independent of IT infrastructure Separates the what from the how
Many industry based schema standards have been developed For example, Financial Services:
ISO15022 (SWIFT, FIX, FpML) XBRL (business reporting)
Any XML based infrastructure can handle multiple and evolving schema standards without excessive cost Due to changes in business relationships Due to regulatory changes (e.g. Basil II) Due to evolution of the schemas themselves
6
The Web Services architecture
UDDIRegistry
2. Request contract information
3. Retrieve WSDL definition
4. Exchange SOAP messages
WSDL
1. Register contract information
ServiceConsumer
ServiceProvider
WSDL
Web Services is based on three standards
Simple Object Access Protocol (SOAP) defines the communication mechanism
Universal Directory Discovery Interface (UDDI) defines the registry of interface definitions
Web Service Definition Language defines the actual interfaces
7
SOAP- Simple Object Access Protocol
XML based protocol for exchange of information Encoding rules for datatype
instances Convention for representing
RPC invocations
Used with XML Schema Normally HTTP-based
Uses Request/Response Two different modes
RPC Document
SOAP with Attachments allow arbitrary data to be packaged.
SOAP1.1 MessageStructure
SOAPEnvelope
HeaderEntries
Header
Body
FaultElement
8
SOAP Example: Request
Sample SOAP Message embedded in an HTTP Request
POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: 1024SOAPAction: "http://example.org/2001/06/quotes"
<env:Envelope xmlns:env="http://www.w3.org/2001/06/soap-envelope" ><env:Body><m:GetLastTradePrice env:encodingStyle="http://www.w3.org/2001/06/soap-encoding" xmlns:m="http://example.org/2001/06/quotes"><symbol>IBM</symbol></m:GetLastTradePrice></env:Body></env:Envelope>
9
SOAP Example: Response
SOAP message sent by the StockQuote service in the corresponding HTTP response to the request
HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: 512
<env:Envelope xmlns:env="http://www.w3.org/2001/06/soap-envelope" ><env:Body><m:GetLastTradePriceResponse env:encodingStyle="http://www.w3.org/2001/06/soap-encoding" xmlns:m="http://example.org/2001/06/quotes"><Price>97.5</Price></m:GetLastTradePriceResponse></env:Body></env:Envelope>
10
UDDI• Universal Description, Discovery and Integration
• Platform-independent, open framework for describing services, discovering businesses, and integrating business services.
• A DNS-like model implementation of the directory
• Originally intended to support global registries
• Created during the .com bubble.
• Includes White, Green and Yellow Pages for search purposes
• Now primarily inside organisations if at all
11
Web Service Description Language (WSDL)
Interface definition language in XML Conceptually, no different from Enterprise Java Bean or
Common Gateway Interface Based on XML Schema Can appear to be very verbose
An interface description is a contract between the server developers and the client developers WSDL describes the web service Similar to Java method signatures
12
Interoperability Challenges
Interoperability remains the chief challenge of web services Complex and imprecise standard Tools generating SOAP, WSDL, UDDI, etc. need to be
interoperable
Web Services Interoperability (WS-I) focus on creating to Interoperability WS-I Basic Profile 1.0 defines an interoperable web services
platform
13
WS-I Basic Profile
WS-I Basic Profile 1.1: SOAP 1.1 WSDL 1.1 Must use HTTP binding, should use HTTP 1.1 XML Schema Part 1, Part 2 May use HTTPS SOAP messages should use document/literal
V1.2 in draft form
14
Web Services: Another approach to distributed computing
Transport
Messaging
Description
Discovery
Quality Of Service
Builds on the legacy of CORBA, J2EE etc It is not a new component model, programming
model or programming language. UDDI/WSDL/SOAP provide another
distributed computing technology Standards developing for the Quality of
Services and other EAI-type functionality. Exercise: Write down the standards for J2EE
15
Web Services: Another approach to distributed computing
Transport
Messaging
Description
Discovery
Quality Of Service
HTTP, MQ, SMTP
XML
SOAP
XSD, WSDL, WS-Policy
UDDI
WS-Reliable
Messaging
WS-Security
WS-BA
WS-Coordination
16
Web Services Strengths
Interoperability Based on open standards, utilizes existing infrastructure Can be accessed from any programming language/model
Ubiquity Communicates through XML/HTTP – Any system that supports
these standards, supports Web Services Support from all major software vendors (IBM and Microsoft)
Low barrier to entry Concepts easy to understand, easy to implement Toolkits allow COM, JEE, and CORBA components to be
exposed as Web Services
17
Web Services and XML/WS standards Java API for XML Parsing (JAXP)
JAXP enables applications to parse and transform XML documents Independent of XML processor implementation
JAXP includes common industry standard components/interfaces DOM (Document Object Model and SAX (Simple API for XML Processing) XSLT (XML Style Language Transformations)
JAXP adds additional functionality beyond these standards Java API for XML Remote Procedure Call (JAX-RPC) SOAP (Simple Object Access Protocol) 1.1 specification
Java API for XML Registries (JAX-R) APIs to access UDDI Registry