Enterprise Systems

advertisement
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
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.
3
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"/>
4
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
5
The Web Services architecture

UDDI
Registry
2. Request contract information


3. Retrieve WSDL definition
Service
Consumer
WSDL
Web Services is based on three
standards
Simple Object Access Protocol (SOAP)

WSDL
Universal Directory Discovery Interface
(UDDI)


Service
Provider
defines the registry of interface definitions
Web Service Definition Language

4. Exchange SOAP messages
defines the communication mechanism
defines the actual interfaces
1. Register contract information
6
SOAP- Simple Object Access
Protocol

XML based protocol for
exchange of information




Used with XML Schema
Normally HTTP-based


Uses Request/Response
SOAP
Envelope
Header
Entries
Header
Body
Two different modes



Encoding rules for datatype
instances
Convention for representing
RPC invocations
SOAP1.1 Message
Structure
RPC
Document
SOAP with Attachments
allow arbitrary data to be
packaged.
Fault
Element
7
SOAP Example: Request

Sample SOAP Message embedded in an HTTP Request
POST /StockQuote HTTP/1.1
Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: 1024
SOAPAction: "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>
8
SOAP Example: Response

SOAP message sent by the StockQuote service in the
corresponding HTTP response to the request
HTTP/1.1 200 OK
Content-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>
9
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
10
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
11
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
12
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
13
Web Services: Another approach to
distributed computing





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
Quality Of Service
Discovery
Description
Messaging
Transport
14
Web Services: Another approach to
distributed computing
WSReliable
Messaging
WSSecurity
WSBA
Quality Of Service
WSCoordination
UDDI
Discovery
XSD, WSDL, WS-Policy
Description
SOAP
Messaging
XML
HTTP, MQ, SMTP
Transport
15
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
16
Web Services and XML/WS standards

Java API for XML Parsing (JAXP)



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




JAXP enables applications to parse and transform XML documents
Independent of XML processor implementation
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
17
Download