Dr. Amor Lazzez: Web Services

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

27/05/2015

Web Services

Dr. Amor Lazzez

Office location: Tarbia Campus (C/ 306)


Phone: 0549071465 (cell)
Email: a.lazzez@gmail.com

502510-3/Systems-Integration
Week 10
Source: This slides is largely prepared based on Chapter 3 from textbook “Service-Oriented Architecture: A Field Guide to
Integrating XML and Web Services” by Thomas Erl

Supporting Interactions

• Purpose of Systems Integration is to support each of


the following:
– Human to Human Interactions
– Human to Machine (Applications) Interactions
– Machine (Applications) to Machine interactions
• What type of interaction does Web technologies
support?
• What type of interaction does Client-Server
architecture support?
• Can name standards we can take advantage of to
support above interactions?

1
27/05/2015

Constructs Necessary to Support


Interactions
• Different things necessary to support
interactions
– Language (English, ASP.Net, Java)
– Vocabulary (meaning of words, meaning of code)
– Context (conversation context)
– Medium (communication channel, ability to speak,
and ability to listen)
– Situation awareness (recognizing where you are,
role of the person)

New Frontier: Service Computing

Source: Coyle, F.P., XML, Web Services, and the Data Revolution, 2002, ISBN: 0-201-84456-7

2
27/05/2015

Is Amazon.com a Web Service?


Accessing Amazon.com to buy products through browser.

Just services over web. NOT a Web Service.

Amazon Web Service

Web Site Owners


(Associates) –
people who own
Web sites and
link to Amazon
in return for
referral fees.
Hundreds of
thousands of
associates.

https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html

3
27/05/2015

Amazon Web Service

Web service enables


this interaction

Amazon

Amazon Web Service

SOAP request for


movies of
“charlie chaplin”

Amazon
Web Service
SOAP response
list of charlie
chaplin movies

4
27/05/2015

Web Services
• Web service supports application-to-application
communication
• Supports “loosely coupled” integration
• Minimizes the amount of effort required to build
integrated applications.
• With Web services,
• the applications or programmers can find cooperative
programs to accomplish a specific task,
• allowing programmers to rapidly assemble applications
by merely tying together application modules.
• Web services are designed to enable application modules
(objects) to communicate with other application modules.
• Once connected, service applications provide transactional or
computational services.

Three main “parts” to Web services

1. Data is presented & shared using XML

2. Applications find services and share information and data


across diverse systems environments using shared, open,
emerging technology standards - SOAP, UDDI, WSDL etc.

3. How communications take place over a common network


(the Internet) using HTTP protocol as the transport

The above parts are supported by


Service-Oriented Architecture

5
27/05/2015

Service-Oriented Architecture
• Consider a scenario of finding a plumber
to fix a plumbing problem.
– Find a plumber in Yellow Pages
(Discovery)
– Plumber should have advertised in the
Yellow Pages (Publishing)
– You call plumber to schedule
appointment (Binding)

• Three basic participants


– Service Provider
– Service Registry
– Service Requestor
• Three basic operations
– Publishing services
– Discovering services
– Binding services

Service-Oriented Architecture
1. Service Provider
– Develops an application and converts into a service
– Creates a WSDL document describing the capabilities of the service and how to access
the service
– Publishes the WSDL document in a service registry (UDDI)
2. Service Requestor
– Needs a service for specific task/purpose
– Searches for services in the service registry
meeting needs
– Selects a service that is satisfactory

3. Service Requestor’s
application invokes the
provider’s service 2 1
• Upon acceptance,
application and service
can exchange data 3
using SOAP

6
27/05/2015

Key Web Service Standards: SOAP

• Simple Object Access Protocol (SOAP) specification


– Submitted to W3C in 2000
– SOAP 1.1 became standard in July 2003
– SOAP 1.2 become standard in April 2007 (current
standard version)
– XML-based messaging format established a transmission
framework for inter-application (or inter-service)
communication via HTTP
– SOAP specification is vendor neutral technology,
therefore, it was an attractive alternative to proprietary
protocols such as CORBA and DCOM
– http://www.w3.org/TR/soap/

Key Web Service Standards: WSDL

• Web Service Description Language (WSDL)


specification
– XML-based language for describing the interface
of Web services.
– WSDL 1.1 became standard in March 2001
– WSDL 2.0 became standard in June 2007
(current standard version)
– http://www.w3.org/2002/ws/desc/

7
27/05/2015

Key Web Service Standards: UDDI

• Universal Description, Discovery, and


Implementation (UDDI) specification
– Mechanism for the dynamic discovery of service
descriptions
– UDDI 2 became standard in April 2003
– UDDI 3 became standard in February 2005
(current standard version)
– http://www.oasis-
open.org/committees/tc_home.php?wg_abbrev=u
ddi-spec

Relationship between key Web service


standards

1
1. Use UDDI to search for
services
2
– Use SOAP to access UDDI 3
– Search using key words
2. Download WSDL
document from UDDI for
selected service 4
3. Use URI information from
WSDL document to
invoke the service using
SOAP
4. After the services accepts
your request, then your
application and the
service can exchange
data using SOAP

8
27/05/2015

Client Server and Peer-to-Peer Architectures


HTTP Request
Client
Client Server 1 Lookup address

HTTP Response Exchange


Messages Server
Client-Server Architecture
Client
Lookup address
2

Peer-to-Peer Architecture

• Is SOA more like Client-


Server or Peer-to-Peer
architecture?
– SOA is more like Peer-to-Peer
Service-oriented Architecture
Architecture (SOA)

Web-based Application Development

Browser Web/ Database


Application Server
Server

9
27/05/2015

Application Integration

- Applications Running in a server

Application Integration as Services

Wrapper is a middleware. Middleware techniques and integration patterns we


learned in earlier in the semester can be applied to develop wrapper services.

10
27/05/2015

A logical representation of a Web service


based integration

WSDL documents representing Web services


to applications

• The integration layer introduced by the Web services framework establishes a


standard, universally, recognized, and supported programmatic interface.
• WSDL enables communication between these layers by providing standardized
endpoint descriptions.

11
27/05/2015

Web Service Description Language (WSDL)

• Abstract – the description of a Web service interface,


independent of implementation details
• Abstract interface
definition is made up of
– Interface and Message
elements
• Concrete – specifies
location and
implementation
information about a
Web service
• Concrete interface
definition is made up of
– Binding, Endpoint, and
Service elements

WSDL Definition Elements – Abstract


Interface definition
• Interface – contain a group of logically related operations
• Operations – represents a single action or function performed
by an application (i.e., a method in an application)
• Operations consists of group of related
input and output messages
– Message exchanges required to support
execution of the operation
• Message element can contain one or
more input or output parameter that
belong to an operation.
– Part elements are used to define
parameters
• Part element provides a name, value
set, along with an associated data
type.

12
27/05/2015

WSDL Definition Elements – Concrete


(Implementation) definition
• Service – represents one or more endpoints at which the
Web service can be accessed
• Endpoint – consist of location (URI) and protocol information
• Binding – defines invocation
requirements of each of its operation
– Associates protocol and message format
information to operations
– Operations construct within Binding block
resembles its counterpart in the interface
section
• Each Endpoint can reference to a
Binding element, and therefore relates
the Endpoint information to the
underlying operation

WSDL Supplementary Constructs

• Provide additional
information about the
service
• Types element – provide
data type support for Web
service definitions
– XSD Schema information is
provided
• Documentation element
allows supplementary
annotations to be added

13
27/05/2015

WSDL Document for a BookCatalog Service


<description>
<message name="BookInfo"> ……
Abstract
<part name="title" type="xs:string">
Interface
Field Guide <types>
</part>
Definition <xsd:schema
<part name="author" type="xs:string"> targetNamespace=http://www.examples.ws/
Mr. T xmlns=http://www.w3.ord/2000/10/XMLSchema>
</part> </xsd:schema>
</message> </types>
<interface name ="Catalog"> <documentation>
<operation name ="GetBook"> Example WSDL Document from Erl SOA
Textbook Chapter 3
<input name="Msg1" message="BookInfo" />
</documentation> Supplementary
</operation>
</description> Definition
</interface>
<service name="Service1">
<endpoint name="Endpoint1" binding="Binding1">
. <soap:address
location:http://example.ws/bookcatalogservice />
</endpoint>
<binding name="Binding1">
<operation>
<input name="Msg1" message="book" />
</operation>
</binding> Concrete (Implementation)
</service> Definition
…..

Simple Object Access Protocol (SOAP)


• SOAP specification establishes a standard message format that consists
of an XML document capable of hosting RPC and document-centric data
– Document-centric is most commonly used, due to standard endpoint description is
provide in WSDL

• SOAP facilitates
synchronous
(request and
response) as well
as asynchronous
(process-driven)
data exchange
models

14
27/05/2015

SOAP Message Structure


• The root Envelope element frames the message document consists of a
mandatory Body element and an optional Header element
• Header element is used for
– Including implementation of SOAP extensions
(advanced Web service standards)
– Identification of target SOAP intermediaries
– Processing information for SOAP intermediaries
– Providing supplementary meta information
about the SOAP message
• Within the Body element, data being delivered
by the SOAP message is included
• Fault element can be used host exception
information
– Embedded within Body element

Example SOAP Document


<Envelope xmlns=“http://www.w3.org/2003/05/soap-envelope>
<Header>
<shipping>UPS</shipping> Header Block
</Header>
<Body>
<Book xmlns=http://www.example.ws/>
<Title>SOA A Field Guide to Integration XML and Web Services</Title>
</Book>
<Fault>
<Code>
Body Block
<Value>VersionMismatch</Value>
</Code>
<Reason>
<Text>Version do not match</Text>
</Reason>
</Fault>
</Body>
</Envelope>

15
27/05/2015

Universal Description, Discovery, and


Implementation (UDDI)
• Fundamental of SOA is a mechanism for service
descriptions to be discovered by potential requestors.
• UDDI is a central directory that hosts service descriptions
(including WSDL)
• UDDI specifies
a Registry that
stores service
descriptions
within a
directory

• UDDI Registry can be


– Public Registry - a global directory of services
– Private Registry – repositories of services
hosted within an organization

UDDI Registry Elements


UDDI registries are organized into six primary types of data:
• Business Entities (businessEntity element)
– Provides profile information about the registered business, including its name, a
description, and a unique identifier
• Business Services (businessServices element)
– Records of the actual services offered by the registered business are nested within the
businessEntitity element
• Specification Pointers
(bindingTemplate element)
– Provides address linking the
businessService to
implementation information
– Developer can learn how and
where to physical bind to a Web
service
• Service Types (tModel element)
– Points to location of service
interface definitions (WSDL),
message formats, as well as
message and security protocols

16
27/05/2015

UDDI Registry Elements


• Business Relationships (publisherAssertion element)
– Provides a means of establishing the relationship of the current businessEntity with
another
• Subscriptions (subscription element)
– Allows subscribers to be notified when business entity profile information is updated

Accessing UDDI Registry


• UDDI provides inquiry and publishing APIs allowing
applications to interface programmatically with a registry
• Registries are expected to provide interface for humans as
well

17
27/05/2015

Simple Web Service Example


• Calculator Application
<description>
<message name="input">
<part name="input1" type="xs:int" />
<part name="input2" type="xs:int" />
</message>
<interface name ="div">
<operation name ="add">
<input name="Msg1" message="input" />
</operation>
</interface>
<service name="calculator">
<endpoint name="Endpoint1" binding="Binding1">
. <soap:address location:http://example.ws/calculator/div />
</endpoint>
<binding name="Binding1">
<operation>
<input name="Msg1" message="input" />
</operation>
</binding>
</service>
</description>

Simple Web Service example


• List of available services in the UDDI registry

18
27/05/2015

SOAP 1.1 Request via HTTP

POST /Divide HTTP/1.1


Content-Type: text/xml; charset=“utf-8”
Content-Length: nnnn
SOAPAction:“http://localhost:6060/wsdl/div/Divide#divNum

<soapenv:Envelope
xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/”>
<soapenv:Body>
<m:Divide_divNum_1_Request>
<xsd:num1>10</xsd:num1>
<xsd:num1>2</xsd:num1>
</m:Divide_divNum_1_Request>
</soapenv:Body>
</soapenv:Envelope>

SOAP 1.1 Response by HTTP

HTTP/1.1 200 OK
Content-Type: text/xml; charset=“utf-8”
Content-Length: nnnn

<soapenv:Envelope
xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/”>
<soapenv:Body>
<m:Divide_divNum_Response>
<xsd:response>5</xsd:response>
</m:Divide_divNum_Response>
</soapenv:Body>
</soapenv:Envelope>

19

You might also like