Web Services Evolution
Web Services are an Architectural Evolution.
Web Services are an Architectural Evolution.
What are Web Services?
IBM Main Frame Data Base 2 Tier Data Base 3 Tier
Web Server
Web Internet
Web Server
N Tier
Internet
Application
Server Web Server
Internet
Application Server
Current distributed infrastructure
Microsoft:
– DCOM/COM+
SUN:
– Java RMI
CORBA:
– Try to be a standard specification ( but complex to use)
Disadvantages
• Vendor Specific
• Platform Specific
• No interoperability
4
Web Evolution
XML XML Programmability Programmability Connectivity Connectivity HTML HTML Presentation Presentation TCP/IP TCP/IP Techno logy Techno logy Innovation InnovationFTP,FTP, E-mail, Gopher E-ma
il, Gopher
Web Pages
Web Pages
Browse Browse the Web the Web Program Program the Web the Web Web S ervices Web S ervices
Introduction
Definition of Web Service
– A Web service is a software application identified by a
URI, whose interfaces and binding are capable of being
defined, described and discovered by XML artifacts and supports direct interactions with other software applications using XML based messages via Internet-based protocols. (W3C definition)
– A web service is a self-contained, language neutral, platform independent, and loosely coupled application. It can be described, published, located, and invoked over the Internet
– “Web services” is an effort to build a distributed computing
Characteristics
A Web Service is accessible over the Web.
Web Services communicate using platform-independent
and language-neutral Web protocols.
A Web Service provides an interface that can be called
from another program.
A Web Service is registered and can be located through
a Web Service Registry.
Web Services support loosely coupled connections
between systems.
Advantages of web services
Loose Coupling
Standard-Based (interoperability)
Flexibility
Reusability
Scalability
Reduced Complexity
Programmatically Accessible
Web Services Technologies
XML Messaging
– Simple Object Access Protocol (SOAP) - is an XML Messaging
Protocol that allows software running on disparate operating systems and different environments to make Remote Procedure Calls (RPC)
Web Services Description
– Web Service Description Language (WSDL) – is a language that defines the interface of a Web service, required for interaction between a requester and a service provider
Web Services Registry
e
X
tensible
M
arkup
L
anguage
All the technologies in Web Services are XML based
– Messaging
– Description Are all in XML – Registry
Why?
– XML is pure text with no binary data – Applications read the XML
– Applications share data using XML . Any application can talk to any other application using XML (unlike binary) irrespective of the platform
XML Document
<?XML version=“1.0” encoding=“UTF-8” standalone=“no”?>
<!–- this is an XML comment -->
<books xmlns=“somename"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=“somename M:\XML\Schemas\docbook.xsd">
<book year=“2000” book-title=“XML in Depth”>
<author>
<title>Mr.</title> John Doe
</author>
<publisher> &pub </publisher> </book>
</books>
XML Rules
Well formed
– Syntax is correct (all tags opened and closed)
Valid
– All the elements matches the definitions written in the schema
XML Documents (.xml) == XML Instances of the Schema (.xsd) DTD
– Document Type Definitions – Validates XML data against it
XML Schema
– Alternative to DTD with added functionality. It supports other data types not supported by DTD
Predefined Simple Types (integers,booleans,dateTime…) User-defined datatypes ( Complex Types)
Validations Restrictions to types
– XML schema itself is an XML document !
XML Processing
– Read the XML documents XML processors (Parsers) SAX (based on events)
SOAP: Simple Object Access Protocol
An Internet standard specification, the goal of which is to define a platform and vendor-neutral WIRE PROTOCOL based on Internet standard protocols [HTTP & XML] to access Web Services
How do we access a service???
– With a SOAP message: Is a XML stream which is used to transmit messages via HTTP
SOAP Structure
– Envelope: contains the entire SOAP message – Header
– Body
Message
Envelope
Header
Body
SOAP Example
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/ XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body>
<m:calculateCarPayment
xmlns:m="http://www.exadel.com/services/CarPayment.xsd">
<loanAmount xsi:type="xsd:string">5000</loanAmount> <loanTerm xsi:type="xsd:string">12</loanTerm>
<loanRate xsi:type="xsd:string">8</loanRate> </m:calculateCarPayment>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
This example sends a request for a web service method called calculateCarPayment with three different arguments
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/ XMLSchema">
<SOAP-ENV:Body>
<ns1:calculateCarPaymentResponse xmlns:ns1="http://www.exadel.com/services/CarPayment.xsd"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Result xsi:type="xsd:double">434.94</Result> </ns1:calculateCarPaymentResponse>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
Soap Example II
The response could include Fault elements to describe any error that occurred invoking the service
Figure 1. A client invoking a Web service
Soap libraries-engines
To run SOAP :
– XML Spy
Soap Engine
– Apache AXIS: Is an application you include inside Tom Cat Has Java API’s that talk to SOAP
Python SOAP Libraries
– Python SOAP Libraries
4Suite SOAP, administered by Fourthought
SOAPy, administered by Adam Elman
SOAP.py, a project of the Web services for Python project
• SOAP.py 0.9.5 download from http://sourceforge.net/projects/pywebsvcs
soaplib, by Secret Labs
Orchard, by Ken MacLeod
PySOAP, administered by Dave Warner
The good part of this is that SOAP is completely transparent to developers when trying to access web services
WSDL Web Service Definition Language
WSDL is an XML-based language used to define Web Services
and describe how to access them.
It is the external interface for a client (IDL)
WSDL includes information about
– Data types it uses
– Parameters it requires and returns – Groupings of functionality
WSDL Structure
<definition> - Root element
<types> - Provides data type definitions
<message> - Represents the abstract definition of the
data being transmitted
<portType> - Defines a set of abstract operations
<binding> - Specifies concrete protocol and data format
specifications for the operations and messages defined by a particular portType
<port> - Specifies an address for a binding
UDDI Universal Description Discovery and Integration
Marketplaces, search engines, and business apps query the
registry to discover services at other companies
3.
Business uses this data to facilitate easier integration with each other over the Web 4.
2.
• Businesses populate
the registry with descriptions of the services they support
Business Descriptions
SW companies, standards bodies, and programmers populate the registry with descriptions of different types of services
1.
UDDI Registries
https://uddi.ibm.com/testregistry/registry.html
http://demo.alphaworks.ibm.com/browser/
http://uddi.microsoft.com
Web Service Composition
The process of developing a
composite web services
is
called
Web
Service Composition
.
Composition
is the ability to provide
value-added
services
through integration of other web service
components
Web Service Composition Examples
Web Users
– Make the travel arrangements for a conference – Buy all the DVDs in Star Wars series
– Arrange doctor and hospital appointments for relative
Pervasive computing
– E-mail my presentation to all the people in the conference room and project it on the screen
B2B Applications
– Purchase the items … from suppliers that satisfy … and arrange the shipment so that delivery will be done in … days without
exceeding the cost limit
Grid computing
Web Services Usage Scenarios
Remote Web Service Repository Remote Web service Remote Web service Remote Web service Service Requestor Individual Service Invocation Composite Service Execution Publish Web Services Web Service Lookup Invoke WS Compose Abstract Process Web Service Lookup Execute Search Invoke Searc h Execute (SOAP) SOAP (SOAP ) (SOAP) (WSDL) (UDDI)WSFL Service Providers
Service Broker
Web Service Composition Approaches
Manual vs. Automatic
– Manual composition is performed by means of employees who have access to the elementary services
– Automatic implies that a software agent performs composition based on some predefined algorithm
Static vs. Dynamic
Why Dynamic Web Service Composition
Greater Flexibility
The customization of software, based on individual needs of a user, can be made dynamic
New Services can be created at runtime
The capabilities of the application can be extended at runtime
Users are not interrupted during upgrades of applications
Users can continue to interact with the old services while composition of new services is taking place
Unlimited Set of Services
28
Composition techniques 1/3
Composition Language
A combination of architectural description language
(ADL), a scripting language, a glue language, and a
coordination language
Pros
Specifically designed to assemble components
Uses components that have standardized interfaces
Define higher level abstraction to better describe composition
Cons
More complex in comparing with other techniques
Recursive composition is not possible
29
Composition techniques 2/3
Workflow Driven Composition
Builds web services to an abstract process based on
business and process constraints and generate an
executable process
? Check credit Start End Service Provider A Service Provider B Service Provider C Restaurant Selection Check Passed? Yes Abort Wheel Delivery Credit Card Restaurant Selection Check credit Routing30
Composition techniques 2/3
Workflow Driven Composition
Pros
Users can participate in composition
Simple monitoring and recovery procedures
Recovery plans can be included in the workflow
Easier to impose distributed execution of composite services
Cons
Composed service can’t be advertised
Recursive composition becomes more difficult
31
Composition techniques 3/3
Ontology Driven Composition
The ontological descriptions and relationships of web services with other services are used to automatically and semi-automatically composing web services
Place
Building
Room
Object
Mobile
phone
Person
Prof
OwnedBY LocatedIn
PartOf
PartOf
Park Stationary
32
Composition techniques 3/3
Ontology Driven Composition
Pros
Consider semantics
Supports easier forms of requesting composition (English-like
queries)
Can be integrated with any other technique Enables distributed composition and execution
Cons
Too hard to verify the effectiveness of the ontology Domain specific
No agreed-upon taxonomy as the foundation of the ontology Assumes that elementary services are semantically
represented
Orchestration vs. Choreography
There are two ways to compose web services: either
through orchestration or choreography.
Choreography, in contrast, does not depend on a central orchestrator.
Each Web service that participates in the choreography has to know exactly when to become active and with whom to interoperate.
Choreography is based on collaboration and is mainly used to
exchange messages in public business processes.
Orchestration vs. Choreography
Orchestration
A Single Director In Control
BPEL follows the
orchestration paradigm
Choreography
Defines Interaction.
WSCI and WS-CDL are