Sunteți pe pagina 1din 12

System Integration

Chapter 4- Web service Technologies


 SOAP
 WSDL
 UDDI

4.1. Introduction to Web Service Technologies

4.1.1 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

4.1.2 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.


4.1.3 Components of Web Service

1. XML Technologies (“Extensible Markup Language”)


– Base XML for documents
– XML Schema for describing XML documents
2. 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
3. WSDL (“Web Services Description Language”)
– Defines all details about a service
4. UDDI (“Universal Description, Discovery and Integration”)
– One way to advertise and discover services

4.1.4 Web Service Architecture

Web Services involve three major roles

Service Provider

Service Registry

Service Consumer

Three major operations surround web services

Publishing – making a service available

Finding – locating web services

Binding – using web services


The operations are carried out in the following order.

The service provider publishes its service(s) to a service registry such as UDDI in
the form of a WSDL document.

The service requestor finds services for consumption via service registries and
this process is also called “service discovery.”

Once the service requestor has acquired the service information, it can attempt to
bind to the service and use it.

Making a service available

In order for someone to use your service they have to know about it.

To allow users to discover a service it is published to a registry (UDDI).

To allow users to interact with a service you must publish a description of it’s interface
(methods & arguments).

This is done using WSDL.

Once you have published a description of your service you must have a host set up to
serve it.

A web server is often used to deliver services (although custom application – application
communication is also possible).

This is functionality which has to be added to the web server.

4.2. SOAP
4.2.1. Introduction

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
4.2.2. Structure of a SOAP Message

A SOAP message consists of:

– Envelope - identifies the message boundary and includes:

• Header - contains meta-data

• Body - contains the request and response XML documents


4.2.3. 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>

4.2.4. Simple Example – in SOAP

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>

4.2.5. 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
o Accepting incoming SOAP messages and passing them up in the stack
 Also, most Web Servers include a SOAP processor
o 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”.
4.2.6. SOAP Messaging Layers

4.2.7. 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.

4.3. WSDL
4.3.1. Introduction
 The service interface is defined in a service description expressed in WSDL. The
WSDL specification defines:
o What operations the service supports and the format of the messages that
are sent and received by the service.
o How the service is accessed - that is, the binding maps the abstract
interface onto a concrete set of protocols.
o Where the service is located. This is usually expressed as a URI (Universal
Resource Identifier).
 The following figure illustrates the use of WSDL. At the left is a service provider.
At the right is a service consumer. The steps involved in providing and consuming
a service are:

1. A service provider describes its service using WSDL. This definition is


published to a repository of services. The repository could use Universal
Description, Discovery, and Integration (UDDI). Other forms of directories
could also be used.
2. A service consumer issues one or more queries to the repository to locate a
service and determine how to communicate with that service.
3. 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.
4. The service consumer uses the WSDL to send a request to the service provider.
5. The service provider provides the expected response to the service consumer.

4.3.2. Structure of a WSDL specification

4.3.3. 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.

4.3.4. 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>

4.4. UDDI Technology

4.4.1. Introduction

 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
 The repository shown in the above figure could be a UDDI registry. The UDDI
registry was intended to eventually serve as a means of "discovering" Web Services
described using WSDL. The idea is that the UDDI registry can be searched in
various ways to obtain contact information and the Web Services available for
various organizations.

4.4.2. 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, …

4.4.3. How UDDI Works?

4.4.4. 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
Example for sending messages using web services

 The next figure provides more detail on the messages sent using Web Services.
 At the left of the figure is a fragment of the WSDL sent to the repository. It shows a
CustomerInfoRequest that requires the customer's account to object information.
 Also shown is the CustomerInfoResponse that provides a series of items on customer
including name, phone, and address items.
5. At the right of this figure is a fragment of the WSDL being sent to the service consumer.
This is the same fragment sent to the repository by the service provider. The service
consumer uses this WSDL to create the service request shown above the arrow
connecting the service consumer to the service provider. Upon receiving the request, the
service provider returns a message using the format described in the original WSDL. That
message appears at the bottom of the figure.

S-ar putea să vă placă și