SOAP

clappingknaveΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 3 μήνες)

57 εμφανίσεις

WEB SERVICES

Sabri Kızanlık

Ural Emekçi

Agenda


Web Service definition


Extensible Markup Language


Simple Object Access Protocol


WSDL


UDDI


Service Oriented Architecture

Web Service definition


An open standard for
accessing component
-
based applications




Core Web services
standards include XML,
WSDL, SOAP and UDDI



Advanced Web services
provide support for
security, transactions,
reliability, business
processes, and
management

Service Standards


XML



eXtensible Markup Language


A
uniform data representation and exchange
mechanism.


SOAP



Simple Object Access Protocol


A
standard way for communication.


UDDI



Universal Description, Discovery
and Integration specification


A mechanism
to register and locate WS based application.


WSDL



Web Services Description
Language


A standard meta language to
described the services offered.


Web Services Specifications

An Example


Two endpoints:
Client

&
Seller


The
Client

finds the
Seller

by searching
UDDI
directory.


The
Service of
Seller

is designed using
WSDL
.


The
Client

gets the service by using
SOAP
.


The
Client

takes a
SOAP

reply defined in
WSDL
.

Model

Extensible Markup Language
-
1

Extensible Markup Language
-
2

Simple Object Access Protocol


Based on

XML


A

simple markup language for describing
messages between applications.


Mainly transferred via HTTP.

SOAP
-

Characteristics


Extensibility


security and WS
-
routing
, ..
.



Neutrality
-

SOAP can be used over any transport
protocol such as HTTP, SMTP or even TCP.



Independen
cy

-

SOAP allows for any programming
model.


SOAP
-

Building Blocks


A required Envelope element that identifies
the XML document as a SOAP message.


An optional Header element that contains
header information.


A required Body element that contains call
and response information.


An optional Fault element that provides
information about errors that occurred while
processing the message.


SOAP


Request


<?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
.
Bazaar
.
org
/Bazaar"
>





<m
:
GetBazaarPrice>


<m
:Type
>
Shirt
<
/
m
:Type
>




<
/
m
:
GetBazaarPrice>


<
/
soap
:
Body>

</soap
:
Envelope>

Soap
-

Response



<?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.Bazaar.org/Bazaar">


<m:GetBazaarPriceResponse>


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


</m:GetBazaarPriceResponse>


</soap:Body>

</soap:Envelope>

WSDL




S
tands for Web Services Description Language.



Based on XML.



WSDL specifies what a request message

and a
response message

must contain
.

A
contract between
the XML Web service and the client
...



In addition to describing message contents,
it

defines
where the service is available and what
communications protocol
can be used to invoke it
.


WSDL
-

Primary Elements


PortType

-

Defines the abstract interface to the

S
ervice
.
A
ssociated with one or more operations
.



Message

-

Defines the information exchanged at

the time
an operation is executed (input

and output)
.

Made of one
or more parts
.


Part


Elemental piece of information in a message (an
individual parameter or return value)


T
ypes
-

The data types used by the web service.


B
inding
-

The communication protocols used by the web
service


Port


Identifies the actual location of the service (a URL,
a Java class, etc..)

WSDL
-

Example

<message name
="
GetBazaarPriceRequest
"
>


<part name
=“"
type
="
xs
:
string
"/
>


<
/
message>

<message name
="
GetBazaarPriceResponse
"
>


<part name
="
value
"
type
="
xs
:
string
"/
>


<
/
message>


<portType name=“BazaarsRates">


<operation name=“GetBazaarPrice">


<input message=“GetBazaarPriceRequest"/>


<output message=“GetBazaarPriceResponse"/>


</operation>

</portType>



WSDL & OO


Example:
a service implemented by a Java
class could define one or more operations.


Operations
would map to individual Java
methods, implemented by the class.


Messages
would map to the return types of
the methods, or to their parameter list.


Parts
would map to the elemental data in
the parameter list or the return values.

UDDI

Service Oriented Architecture

Service Oriented Architecture
-
2


An approach for building
distributed systems

that deliver
application functionality as
services

to either
end
-
user
applications

or
other services




The minimum requirements of an SOA are:



Services



Enterprise service bus (ESB)



Service directory: An organization
-
level

WSDL repository



Internet gateway: Enables internal services

to be exposed to the

Internet

Value of SOA


Build once, use often


One place to make one change


Lower development, operations and maintenance costs


Interface by contract


Loosely couples requestor and provider so each can vary
independently


Integration is explicitly defined and so better understood,
at the application and Enterprise level


Simplified, agreed, defined data and process flows