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

System Integration

Chapter 4- Web service


Technologies
SOAP
WSDL
UDDI
Web Service

• A Web Service is a software system designed to


support interoperable machine to-machine
interaction over a network.
• Web Services Technologies are primarily an
integration or interfacing technology
• – NOT an application development technology
• – Still can develop in existing or new software
development environments
• Web Services Technologies make it easier to tie
together existing or planned software
components
Why Web Services?
• From business standpoint
– Integration within an organization or Between companies
– Allows time/cost efficiencies (Purchase orders, Answering
inquiries, Processing shipment requests)
• Web Services were intended to solve three main problems:
– Interoperability
• Earlier distributed systems suffered from interoperability issues
because each vendor implemented its own on-wire format for
distributed object messaging.
– Firewall traversal
• Web Services use HTTP as a transport protocol and most of the
firewalls allow access though port 80 (HTTP), leading to easier and
dynamic collaboration.
– Complexity
• Supports developer-friendly service system.
Components of Web Service

• XML Technologies (“Extensible Markup Language”)


– Base XML for documents
– XML Schema for describing XML documents

• SOAP (“Simple Object Access Protocol”)


– A simple way to send documents
– Deals with how to format and exchange XML documents
programmatically over the Internet using messages for
transmission
• WSDL (“Web Services Description Language”)
– Defines all details about a service
• UDDI (“Universal Description, Discovery and Integration”)
– One way to advertise and discover services
Web Service Architecture

Registry
(UDDI) Three major roles
Publish
Find Service Provider
(WSDL) Service Registry
(SOAP)
Service Consumer
Service
Service Provider
Requestor

Bind

(SOAP)

Three major operations


Publishing – making a service available
Finding – locating web services
Binding – using web services
SOAP
• SOAP is an XML-based messaging framework
specifically designed for exchanging formatted
data across the internet
• For Example:
• A Weather Service– simple request for weather in an
area, simple response with the weather report
• An Airline special offers service – travel agents would
simply make requests for latest offers and would
receive the offers as a response
Example
Structure of a SOAP Message

SOAP Envelope
SOAP header

Header Block Envelope - identifies the message


boundary and includes:
• Header - contains meta-data
SOAP Body • Body - contains the request and
response XML documents
Body Block
Skeleton SOAP Message in XML

<?xml version="1.0"?>
<soap:Envelope xmlns:soap=“ ... ">
<soap:Header>
... ...
</soap:Header>
<soap:Body>
... ...
< … message payload goes here … >
</soap:Body>
</soap:Envelope>
Simple Example – in SOAP
REQUEST
<methodCall>
<methodName>NumberToText</methodName>
<params>
<param>Call
<value><i4>28</i4></value>
</param>
</params>
</methodCall>

Response
<methodResponse>
<params>
<param>
<value>
<string>twenty-eight</string>
</value>
</param>
</params>
</methodResponse>
Another Example
SOAP Request
POST /InStock HTTP/1.1
Host: www.stock.org
Content-Type: application/soap+xml; charset=utf-8 Content-Length: 150
<?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.stock.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
Response – in SOAP
HTTP/1.1 200 OK
Content-Type: application/soap; charset=utf-8
Content-Length: 126

<?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.stock.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
SOAP Processing

• Within the SOAP environment, the software responsible for


the generation, transmission, reception and analysis of
these messages is known as a SOAP Processor

• These processors can be standalone listeners on TCP ports


– Accepting incoming SOAP messages and passing them up in the
stack
• Also, most Web Servers include a SOAP processor
– But if your Web Server doesn’t include a SOAP processor, then
most Web application development environments allow you to
add a “SOAP plug-in”.
SOAP Messaging Layers

Provider
View Client

App API App API


Developer

SOAP, XML Processing SOAP, XML Processing


SOAP Service Provider

SOAP Message SOAP Message

HTTP HTTP HTTP


SOAP Security
• SOAP uses HTTP as a transport protocol and
hence can use HTTP security mainly HTTP over
SSL.
• But, since SOAP can run over a number of
application protocols (such as SMTP) security
had to be considered.
WSDL

• The service interface is defined in a service


description expressed in WSDL. The WSDL
specification defines:
– What operations the service supports and the format
of the messages that are sent and received by the
service.
– How the service is accessed - that is, the binding maps
the abstract interface onto a concrete set of protocols.
– Where the service is located. This is usually expressed
as a URI (Universal Resource Identifier).
Structure of a WSDL specification

WSDL service definition

Intro XML namespace declarations

Type declarations
Abstract interface Interface declarations
Message declarations

Concrete Binding declarations


implementation Endpoint declarations
Major WSDL Elements

The top level XML element is the definitions element


<definitions> . . . </definitions>
Services are defined using eight major elements:
types: data type definitions used to describe the messages
exchanged.
message: abstract definition of the data being transmitted in a
message. A message consists of logical parts, each of which has
one of the defined types.
operation: Each operation can have an input message and an
output message.
porttype: a set of operations.
binding: specifies concrete protocol and data formats for the
operations and messages defined by a particular portType.
port: specifies an address for a binding, thus defining a single
communication endpoint.
service: used to aggregate a set of related ports.
WSDL Document

<message name="GetStockPriceRequest">
<part name="stock" type="xs:string"/>
</message>
<message name="GetStockPriceResponse">
<part name="value" type="xs:string"/>
</message>
<portType name=“StocksRates">
<operation name=“GetStockPrice">
<input message=“GetStockPriceRequest"/>
<output message=“GetStockPriceResponse"/>
</operation>
</portType>
UDDI Technology

• Supports the ability to register and find


services on the internet
• Service Providers register/publish services
including WSDL file along with searchable
attributes
• Potential clients search UDDI registries to
retrieve WSDL suiting their service needs
UDDI API’s

• Register/publish web services API


– Register_WSDL for publishing
– Major operations: save_service, save_binding, …
• Inquire for web services API
– Inquire_WSDL for inquiring
– Major inquire operations: find_business,
find_service, find_binding,
get_binding_detail,get_service_detail, …
How UDDI Works?
Advantages

• Making it possible to discover the right


business from the millions currently online
• Defining how to enable commerce once the
preferred business is discovered
• Reaching new customers and increasing
access to current customers
• Expanding offerings and extending market
reach

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