Вы находитесь на странице: 1из 50

Service Oriented

Architecture && Web


Services

Ganesh. G. && Team


Wipro - EAI
Chennai
Agenda
 SOA
 What is SOA?
 Rules of SOA
 SOA Characteristics
 Basic SOA Model
 Webservices
 What is a Webservice?
 WS Model and Process flow
 Technologies in WS
 WSDL
 SOAP
 UDDI
 Case Study
 Webservices – Where appropriate?

10/23/08 Ganesh. G. Wipro - EAI Chennai 2


Service Oriented Architecture
Definition
 SOA – a component model that inter-relates the different functional
units of an application, called services, through well-defined
interfaces and contracts between these services.

 The interface is defined in a neutral manner that should be


independent of the hardware platform, the operating system, and
the programming language the service is implemented in.

 This allows services, built on a variety of such systems, to interact


with each other in a uniform and universal manner.

10/23/08 Ganesh. G. Wipro - EAI Chennai 3


SOA Definition – Contd.

 In SOA, there will be a service provider and a


service consumer
 A service-oriented architecture is a collection of
services. These services communicate with
each other (may be by simple data passing or by
involving two or more services coordinating
some activity).
 Communication between consumer and provider
happens in standard message format.

10/23/08 Ganesh. G. Wipro - EAI Chennai 4


Pre SOA World

 A classic example of a pre-SOA system that have been


around for a while is the Common Object Request
Broker Architecture (CORBA) which defines similar
concepts to SOA.

 CORBA is based on IDL, where as SOA is based on


XML based language called WSDL. Hence services
have moved to more dynamic and flexible interface
system than the older IDL in CORBA

10/23/08 Ganesh. G. Wipro - EAI Chennai 5


Rules of SOA
 The messages must be descriptive, rather
than instructive and should be written in a
format, structure and vocabulary
understood by all parties.
 The messages should be extensible.
 Mechanism support to discover a service
provider.

10/23/08 Ganesh. G. Wipro - EAI Chennai 6


What is a Service?

 A service is a function that is


 Well-defined
 Self-contained
 Does not depend on the context or state of other
services.
 A service is the endpoint of a connection.
 Services are what you connect together using
Web Services.

10/23/08 Ganesh. G. Wipro - EAI Chennai 7


SOA Characteristics
 Services are
 Discoverable and Dyanmically bound
 Self-contained and modular
 Stress interoperability
 Loosely coupled
 Network-addressable interface
 Coarse-grained interfaces
 Location-transparent

10/23/08 Ganesh. G. Wipro - EAI Chennai 8


Basic SOA Model

A basic service-oriented architecture can


be depicted as follows.

10/23/08 Ganesh. G. Wipro - EAI Chennai 9


WebServices - Definition
 A Web service is a software application
identified by a URI, whose interface and
bindings are capable of being identified,
described and discovered by XML artifacts
and supports direct interactions with other
software applications using XML based
messages via Internet-based protocols.

10/23/08 Ganesh. G. Wipro - EAI Chennai 10


What is a Web Service?
 Application components
 Communicate using open protocols
 Self-contained and self-describing
 Discovered using UDDI
 Can be used by other applications
 XML is the basis for Web services

10/23/08 Ganesh. G. Wipro - EAI Chennai 11


What is a Web Service? – Contd.
 Using Web services, your application can
publish its function or message to the rest of the
world.

 An interface that describes a collection of


operations that are network accessible through
standardized XML messaging.

 Refers to the technologies that allow for making


connections.

10/23/08 Ganesh. G. Wipro - EAI Chennai 12


Web Services Model

10/23/08 Ganesh. G. Wipro - EAI Chennai 13


Typical Web Service Scenario

10/23/08 Ganesh. G. Wipro - EAI Chennai 14


Web Service Process Flow
 A service provider describes its service using WSDL. This
definition is published to a directory of services. The directory
could use Universal Description, Discovery, and Integration
(UDDI). Other forms of directories can also be used.

 A service consumer issues one or more queries to the


directory to locate a service and determine how to
communicate with that service.

 Part of the WSDL provided by the service provider is passed


to the service consumer. This tells the service consumer what
the requests and responses are for the service provider.

10/23/08 Ganesh. G. Wipro - EAI Chennai 15


Web Service Process Flow –
Contd.
 The service consumer uses the WSDL to
send a request to the service provider.

 The service provider provides the


expected response to the service
consumer.

10/23/08 Ganesh. G. Wipro - EAI Chennai 16


What is WSDL?

 Language for describing web services.

 Format for describing a Web Services Interface.

 Forms the basis for Web Services.

 Way to describe services and how they should


be bound to specific network addresses.

10/23/08 Ganesh. G. Wipro - EAI Chennai 17


WSDL Components
 WSDL has following parts
Types

Message

Port Type

Binding

Port

service

10/23/08 Ganesh. G. Wipro - EAI Chennai 18


Basic Parts of WSDL -
Representation

10/23/08 Ganesh. G. Wipro - EAI Chennai 19


WSDL Components – Contd.
 Port Type
 It is a set of abstract operations. Each operation refers to
an input message and output messages.
 Binding
 It specifies concrete protocol and data format
specifications for the operations and messages defined by
a particular portType.
 A binding Must specify exactly one Protocol
 A binding must not specify address information.
 Per operation Info as well as per Binding Information may
also be specified.

10/23/08 Ganesh. G. Wipro - EAI Chennai 20


WSDL Components – Contd.

 Port
 Itspecifies an address for a binding, thus defining
a single communication endpoint.
 Port must not specify more than one address.
 Port must not specify any binding information
other than address info.
 Service
 It is used to aggregate a set of related ports.

10/23/08 Ganesh. G. Wipro - EAI Chennai 21


Parts of WSDL

 Definitions
 include both data type definitions and message definitions
 Operations
 Operations describe actions for the messages supported by a
Web service
 There are four types of operations: One-way,
Request/response, Solicit response, Notification
 Service bindings
 Service bindings connect port types to a port
 A collection of ports defines a service
 This binding is commonly created using SOAP

10/23/08 Ganesh. G. Wipro - EAI Chennai 22


Sample WSDL File
<?xml version="1.0"?> <definitions name="StockQuote"
targetNamespace="http://example.com/stockquote.ws
dl" xmlns:tns="http://example.com/stockquote.wsdl"
/">
<types> <schema
targetNamespace="http://example.com/stockquote.xsd
" xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="TradePriceRequest">
<complexType> <all> <element name="tickerSymbol"
type="string"/> </all> </complexType>
</element>
<element name="TradePrice">
<complexType> <all> <element name="price"
type="float"/> </all> </complexType>
</element>
</schema> </types>
10/23/08 Ganesh. G. Wipro - EAI Chennai 23
Sample WSDL File
 <message name="GetLastTradePriceInput">
<part name="body"
element="xsd1:TradePriceRequest"/></messa
ge> <message
name="GetLastTradePriceOutput"> <part
name="body" element="xsd1:TradePrice"/>
</message>
<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
<input
message="tns:GetLastTradePriceInput"/>
<output
message="tns:GetLastTradePriceOutput"/>
</operation> </portType>
10/23/08 Ganesh. G. Wipro - EAI Chennai 24
Sample WSDL File
<binding name="StockQuoteSoapBinding"
type="tns:StockQuotePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetLastTradePrice">
<soap:operation
soapAction="http://example.com/GetLastTradePrice"/
> <input> <soap:body use="literal"/> </input>
<output> <soap:body use="literal"/>
</output> </operation> </binding>
<service name="StockQuoteService">
<documentation>My first service</documentation>
<port name="StockQuotePort"
binding="tns:StockQuoteBinding"> <soap:address
location="http://example.com/stockquote"/> </port>
</service></definitions>
10/23/08 Ganesh. G. Wipro - EAI Chennai 25
SOAP
 Stands for Simple Object Access Protocol
 is a communication protocol
 is for communication between applications
 is a format for sending messages
 is designed to communicate via Internet

10/23/08 Ganesh. G. Wipro - EAI Chennai 26


SOAP – Contd.
 is platform and language independent
 is based on XML
 is simple and extensible
 allows you to get around firewalls
 will be developed as a W3C standard

10/23/08 Ganesh. G. Wipro - EAI Chennai 27


Why soap?
 It is important for application to communicate
with each other
 Application communicate using RPC calls
 But a better way to communicate with various
application will be through HTTP. But HTTP was
not designed for this.
 HTTP + XML = SOAP was created to
accomplish this.
 W3C works on this.

10/23/08 Ganesh. G. Wipro - EAI Chennai 28


SOAP – Representation
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap=
"http://www.w3.org/2001/12/soap-
envelope"
soap:encodingStyle=
"http://www.w3.org/2001/12/soap-
encoding">
<soap:Header>
</soap:Header><soap:Body>
<soap:Fault></soap:Fault>
</soap:Body></soap:Envelope>
</xml>

10/23/08 Ganesh. G. Wipro - EAI Chennai 29


SOAP – Representation – Contd.

XML document
 Envelope – identify xml doc is a soap
message
 Header – Optional – header information
 Body – call and response information
 Fault – error info occurred while message
processing

10/23/08 Ganesh. G. Wipro - EAI Chennai 30


SOAP – Representation – Contd.

 must be encoded using XML


 must use the SOAP Envelope namespace
 must use the SOAP Encoding namespace
 must NOT contain a DTD reference
 must NOT contain XML Processing Instructions

10/23/08 Ganesh. G. Wipro - EAI Chennai 31


SOAP HTTP Binding
 HTTP + XML = SOAP
 SOAP method is an HTTP request/response that complies with the SOAP encoding
rules
 SOAP request could be an HTTP POST or an HTTP GET request
Normal HTTP request message
POST /item HTTP/1.1
Host: 189.123.345.239
Content-Type: text/plain
Content-Length: 200
SOAP HTTP Message
POST /item HTTP/1.1
Host: 189.123.345.239
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 250

10/23/08 Ganesh. G. Wipro - EAI Chennai 32


SOAP Example - Request
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">

<m:GetStockPrice> <m:StockName>IBM</m:StockName>
</m:GetStockPrice>

</soap:Body>
</soap:Envelope>

10/23/08 Ganesh. G. Wipro - EAI Chennai 33


SOAP Example - Response
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">

<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>

</soap:Body>

</soap:Envelope>

10/23/08 Ganesh. G. Wipro - EAI Chennai 34


UDDI
 Is an acronym for Universal Description,
Discovery, and Integration
 Is a platform-independent, XML-based
registry for businesses worldwide to list
themselves on the Internet
 Is an open industry initiative, sponsored by
OASIS

10/23/08 Ganesh. G. Wipro - EAI Chennai 35


UDDI – Contd.
 Enables businesses to publish service listings
and discover each other
 Defines how the services or software
applications interact over the Internet
 consists of three components
 White Pages: address, contact, and known identifiers
 Yellow Pages: industrial categorizations based on
standard taxonomies
 Green Pages: technical information about services
exposed by the business.

10/23/08 Ganesh. G. Wipro - EAI Chennai 36


UDDI – Contd.
 Is one of the core Web Services standards
 Is designed to be interrogated by SOAP
messages
 Is meant to provide access to WSDL documents.
 UDDI is not just a specification
 Has a set of publicly available internet-based
implementations

10/23/08 Ganesh. G. Wipro - EAI Chennai 37


Functional flow of UDDI

10/23/08 Ganesh. G. Wipro - EAI Chennai 38


Where UDDI fits in?

10/23/08 Ganesh. G. Wipro - EAI Chennai 39


UDDI and its role
 UDDI addresses a number of business
problems
 Problem: A mid-sized manufacturer may
interact with numerous on-line customers
with differing interfaces and their own
standards and protocols.
 Solution: UDDI broadens and simplifies the
use of B2B through web Service description

10/23/08 Ganesh. G. Wipro - EAI Chennai 40


UDDI and its role – Contd.
 The other scenarios can be:
1. A flower shop in Australia desires to be "plugged in"
to every marketplace in the world but doesn't know
how.
 In such a scenario, UDDI offers a simple one-stop location
for Service Discovery.

2. A B2B marketplace needs to get catalog data for


relevant suppliers in its industry, along with
connections to shippers, insurers, etc.
 In such a scenario, UDDI offers easy integration.

10/23/08 Ganesh. G. Wipro - EAI Chennai 41


How UDDI Works
 A UDDI registry contains programmatic descriptions of
businesses and the services they support.
 It also contains references to specifications (called
Technical Models, or "tModels") which describe how web
services work.
 It is built upon a programming model and schema which
are platform and language independent.
 Business and standards organizations are the primary
source of registry information.

10/23/08 Ganesh. G. Wipro - EAI Chennai 42


How UDDI Works – Contd.
 Populating the registry has several steps.
 Software companies, standards bodies and
programmers populate the registry with descriptions
of various tModels (tModels describe specifications
common to an industry vertical or business. )
 Businesses populate the registry with descriptions of
the services they support.
 UDDI assigns a programmatically unique
universal identifier (UUID) to each tModel and
business registration and stores them in the
registry.

10/23/08 Ganesh. G. Wipro - EAI Chennai 43


How UDDI Works – Contd.
 Marketplaces, search engines, and business
applications then query the registry to discover
services of other companies.
 Businesses then use this data to facilitate easier
integration with each other over the web.
 This can then be a dynamic process where
search and discovery automatically adapts to
available services.

10/23/08 Ganesh. G. Wipro - EAI Chennai 44


Case Study
Web service for bank ATM
 Fujitsu is a
top ATM
vendor.
 ATMs
expected to
provide more
service than
just financial
transactions.

10/23/08 Ganesh. G. Wipro - EAI Chennai 45


Web service for bank ATM – Contd.
 IFX-SOAP Implementation
protocol used in order to make
its ATMs internet enabled.
 ATMs are contact points
between bank operations and
users.
 Data communications
between ATMs,mainframes
and external gateway servers
performed over vendor-specific
protocol as shown in figure.

10/23/08 Ganesh. G. Wipro - EAI Chennai 46


Web service for bank ATM – Contd.
 By connecting ATMs to the
Internet, rich services can be
provided on the Internet
 Expensive and time consuming to
replace all existing ATMs and
external servers with the new ATM
or ATM Switch at once.
 An EAI software package
produced by Fujitsu enables
existing ATMs to coexist with new
ones.

Conclusion: Possible to gradually


and easily add new ATMs and
ATM Switch without changing the
existing system.

10/23/08 Ganesh. G. Wipro - EAI Chennai 47


WS && SOA Where Appropriate?
In general SOA and Web services are most
appropriate for applications:
 That must operate over the Internet where reliability and speed
cannot be guaranteed
 Where there is no ability to manage deployment so that all
requesters and providers are upgraded at once
 Where components of the distributed system run on different
platforms and vendor products
 Where an existing application needs to be exposed for use over
a network, and can be wrapped as a Web service.

10/23/08 Ganesh. G. Wipro - EAI Chennai 48


Questions
&&
Answers

10/23/08 Ganesh. G. Wipro - EAI Chennai 49


THANK YOU

10/23/08 Ganesh. G. Wipro - EAI Chennai 50

Вам также может понравиться