CS 237:Web Services and SOA

joeneetscompetitiveΑσφάλεια

3 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

82 εμφανίσεις



CS 237:Web Services and SOA










Instructor:
Nalini

VenkataSubramaniam





Presenters:




Ankur

Khetan
.




Sunny
Ketkar
.





Web Services

Today’s Web


Web designed for application to human interactions


Served very well its purpose:


Information sharing: a distributed content library.


Enabled B2C e
-
commerce.


Non
-
automated B2B interactions.


How did it happen?


Built on very few standards: http + html


Shallow interaction model: very few assumptions made about
computing platforms.


Result was ubiquity.

What’s next?


The Web is everywhere. There is a lot more we can do!


E
-
marketplaces.


Open, automated B2B e
-
commerce.


Business process integration on the Web.


Resource sharing, distributed computing.


Current approach is
ad
-
hoc
on top of existing standards.


e.g., application
-
to
-
application interactions with HTML forms.


Goal:
Enabling systematic application
-
to
-
application interaction on
the Web.

What are Web Services?


Web Services are self
-
contained,
self
-
describing, modular
applications that can be
published, located
, and invoked across the
Internet.


The W3C defines a "Web service" as:



A software system designed to support interoperable machine
-
to
machine interaction over a network. It has an interface described in
a machine
-
process
-
able format (specifically WSDL). Other systems
interact with the Web service in a manner prescribed by its
description using SOAP messages, typically conveyed using HTTP
with an XML serialization in conjunction with other Web
-
related
standards.


Enterprise Possibilities


Enterprise applications have largely
remained
corporation bound


CORBA
, J2EE and DCOM/.NET applications have
largely remained
behind corporate
firewalls



Web Services describes a new way to perform
inter
-
organizational
distributed computing


Uses
traditional Internet protocols such as HTTP and
SMTP to
carry application data between
organizations
and
beyond corporate
firewalls


Web Services Pros and Cons


Cons


Emerging technology


Managing and Tracking
changes is a challenge


Transactions not fully
addressed


Multiple, evolving security
standards


Processing overhead


Pros


Global method for describing
and finding Internet based
business services


Packaging and publishing of
applications in a readily
understood format


New revenue streams
through syndication of
existing application as Web
Service

Design

Goals


Enable universal interoperability.


Widespread adoption, ubiquity: fast!


Enable (Internet scale) dynamic binding.


Support a service oriented architecture (SOA).


Efficiently support both open (Web) and more constrained
environments.


Requirements


Based on standards. Pervasive support is critical.


Minimal amount of required infrastructure is assumed.


Only a minimal set of standards must be implemented.


Very low level of application integration is expected.


But may be increased in a flexible way.


Focuses on messages and documents, not on APIs.




Web Service Protocols


Extensible Markup Language (XML)


Tagging data such that it can be exchanged between
applications and platforms



Web Service Description Language (WSDL)


A standard method of describing web services and their
specific capabilities (XML)



Universal Description, Discovery, and Integration
(UDDI)


Defines XML
-
based rules for building directories in which
companies advertise themselves and their
web
services



Discovery
Protocol (
DISCO)


Pointer
to all web services on a particular web site


Web Service Structure

UDDI
Registry
Web Site
DISCO file
WSDL
WEB Service
Discovery
Interface
SOAP Messages
Internet
Internet
C# Web Services, Banerjee, et. al.,
WROX, 2001
XML


XML

defines a set of rules for encoding
documents in a format that is both human
readable and machine readable.


All technologies in Web Services are XML
based.


Essential characteristic is the separation of
content from presentation


XML describes only data


Any application that understands XML can
exchange data


XML parser checks syntax

WSDL


Web services are self
-
describing


Description is written in WSDL, an XML
-
based language
through which a web service conveys to applications
the methods that the service provides and how those
methods are
accessed


Services are collection of network endpoints (ports)


Abstract definition of endpoints and messages is
separated from their concrete network deployment or
data format bindings


Allows the reuse of abstract definitions:



messages
-
abstract descriptions of data being exchanged



port types
-
abstract collections of operations



concrete protocol and data format specifications for a
particular port type constitutes a reusable binding


Definitions
-

root node of
WSDL


Types


a container for data
type definitions using some
type system (such as XSD)


Message


an abstract,
typed definition
of the data
being communicated.


Operation


an abstract
description of an action
supported by the service.

WSDL Schema

WSDL Schema


Port Type

an abstract set
of operations supported by
one or more endpoints.


Binding


a concrete
protocol and data format
specification for a
particular port type.


Port


a single endpoint
defined as a combination of
a binding and a network
address.


Service


a collection of
related endpoints.

UDDI


UDDI

is a platform
-
independent, XML
-
based registry by
which businesses worldwide can list themselves on the
internet, and a mechanism to register and locate web service
applications.



Can be interrogated by SOAP messages and provides access
to WSDL documents describing web services in its directory



Entries are stored in a UDDI registry



A UDDI business registration 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.


UDDI

UDDI Information Model


Provider
: Information about the
entity who offers a service



Service
: Descriptive
information about a particular
family of technical offerings


Binding
: Technical information
about a service entry point and
construction specs

tModel
: Descriptions of
specifications for services.

Bindings contain references
to tModels. These
references designate the
interface specifications for
a service.

0…n

0…n

1…n

Invoking a Web Service

Building
a web service


Start by creating a project of type “ASP.NET Web Service”

A web service is…


One or more objects that respond to
web
-
based method calls


there is no GUI design to a web service


only raw classes with methods…

public class
Service1 : System.Web.Services.WebService

{


.


.


.

}

Example


Looks like C#, but
these
are web
-
based methods


client could be calling from any platform


parameters passed using XML

public class
Service1 : System.Web.Services.WebService

{


[
WebMethod
]


public
int

Add(
int

x,
int

y)


{


return x + y;


}



[
WebMethod
]


public string[] Attendees()


{


<<open DB, read attendees into array, return it>>


}

}

attribute

inherit

Building
a client


Start by creating a client…


WinForm
,

WebForm
, console
-
based,
etc.

Reference the component


Component has to be referenced


this will activate IntelliSense


this will make sure we call it correctly


this will enable underlying XML +

SOAP
communication



How?


project
references, right
-
click
,

Add
web

reference…


type URL for web service, e.g.


http://localhost/WebService/Service1.asmx

service


name

class

name


web


server

Program against component


Treat web service like any
other class!


use new to create instances


make method calls


pass parameters

Private Sub Button1_Click(...) Handles Button1.Click


Dim
i
, j, k As Integer



i

=
CInt
(TextBox1.Text)


j =
CInt
(TextBox2.Text)



Dim
obj

As localhost.Service1


obj

= New localhost.Service1()


k =
obj.
Add
(
i
, j)



MessageBox.Show
("Sum = " +
k.ToString
())

End Sub

Underlying execution…


Here's what the call to Add() actually looks like:

Web server

obj

client app

proxy

obj.Add(i, j);

HTTP request: Service1.asmx

<Add>


<n1>10</n1>


<n2>20</n2>

</Add>

.
asmx

web service

obj.Add(10, 20);

Online Travel Service Example


Step 1. User issues request for cheap flight from
HTML page



Step 2. Travel Agent receives HTTP packet and
invokes query operations on the Airline UDDI
Registry



Step 3. Registry returns a detailed listing of
<
servicelist
> elements currently registered for
airline, each containing WSDL description. Repeated
for all airlines.



Step 4. Travel agent gets the location of the WSDL
description for each airline’s price web service.

Online Travel Service Example


Step 5. Travel agent uses previous WSDL description to
issue a SOAP request for the flight’s price to the Airline’s
Web Service



Step 6. Airline’s Web Service accepts request and
forwards it through the firewall to backend systems for
processing



Step 7. Airline’s backend systems get the flight’s price
from the DB and return result to the Airline’s Web
Service through the firewall



Step 8. Airline’s web service returns the flight’s price to
the travel agent

Summary


Web services provide standardized
interface to data and functionality on web


Access to data


Perform computations


Accessible by machines/programs


Stateless


websites don’t keep track of
requests


Preview of things to come: scientific
workflows


Need For SOA



80’s paradigm: Procedural programming
(less reusability)



90’s paradigm: Object Oriented
Programming(distributed systems
,reusability across platforms? )

Software Architecture


Set of principal design decisions of the
system .


Architectural style: name collection of
architectural design decisions that
constrain the design decisions within that
context.


SOA
-
> an architectural style / paradigm

SOA Definition



It is architectural style for building
business applications using loosely
coupled (distributed) services which act
like black boxes and can be orchestrated
to achieve a specific functionality by
linking together.


Service



Services are

self contained,

loosely coupled

units
of functionality that have no

calls

to each other
embedded in them.



They inter
-
operate based on a formal definition
or contract (e.g. WSDL)



Communicate through messages.



Service orchestration


provides means to
automate and integrate multiple web services that
execute on heterogeneous platforms.


Service Properties



Loosely coupled


Stateless:


SOA services neither remember the last thing they
were asked to do, nor care what the next is.


Discoverable:


A service must be “discoverable” by potential
consumers of the service


Self
-
describing:


The SOA service interface describes, exposes, and
provides an “entry point” to the service.


Composable
:


SOA services are, by nature, composite.



As Coarse
-
grained as possible




Service VS Component

Messages


Follow industry standard.


Cross Platform.


Asynchronous.


Reliable.


Secured.



SOA = Services + Messages.

SOA Elements

Seven steps to implement SOA

1.
Create/Expose Services.

2.
Register Services.

3.
Secure Services.

4.
Manage (monitor) Services.

5.
Mediate and
Virtualize

Services.

6.
Govern the SOA.

7.
Integrate Services.



1.
Create & Expose Services


Three primary choices


Rebuild existing applications using SOA paradigm


Expose existing application logic as a set of services


A combination of rebuild and expose


Enterprises typically use a combination of rebuild & expose


Granularity

is a key criterion for Web Service

Source:

SOA Software, Inc., 2008.


2.
Register Services


Application architects & developers need to know that a service exists


Use a
registry


Accepted standard : UDDI

3.
Secure Services


May have inadvertently created gaping security holes


May have exposed sensitive information


E.g. Authentication , Authorization , privacy etc.

Source:

SOA Software, Inc., 2008.


4.
Manage Services


Look for potential disaster


Need to be able to monitor for


Basic Availability


Performance


Throughput


Service Level
agreement



5.
Mediate & Virtualize Services


As SOA matures may need to:


Introduce new versions


Increase capacity by running multiple instances


Expose different interface types.


Solution is Virtualization


XML transformation can be used to allow consumers to use an old version of service that
no longer exists.


Meditation between different standards implementation or versions of standards


Mediation between different messaging styles


RSS, SOAP, REST, Plain old XML (POX)


Content
-
or
-
context
-
based routing to deliver advanced load
-
balancing and high
-
availability
capabilities




Source:

SOA Software, Inc., 2008.


Govern the SOA Cont’d


2 types : design time , run
-
time


Design time : Organizations can control what types of services will be published ,
who publishes , what types of schema and messages can be accepted .


Run
-
time

: Provide a single framework/workbench for controlling all the above
steps at run
-
time.



Integrate Services


Done by using Enterprise Service Bus (ESB).


ESB integrates services into higher
-
level composite .


Encapsulates 3 functional concepts : 1.adapters to ensure connectivity with
legacy applications .



2. Messaging services to ensure reliable delivery.



3. Process orchestration to build agile applications.





SOA VS CORBA / DCOM







THANK YOU!