Chapter 4 SOAP: Simple Object Access Protocol SOAP: Simple ...

squabbletownmushySoftware and s/w Development

Dec 14, 2013 (3 years and 10 months ago)

144 views

Slide 4.1
Chapter 4
SOAP:SimpleObjectAccessProtocol
o
logy
SOAP:

Simple

Object

Access

Protocol
e
chn
o
v
ices:
s
& T
e
Ser
v
c
iple
s
Web
Prin
c
Mike P. Papazoglou
mikep@uvt.nl
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.2
Topics
Topics
•Inter application communication
•SOAP as a messa
g
in
g

p
rotocol
ggp
•Structure of a SOAP message
SOAPcommunicationmodel

SOAP

communication

model
•SOAP fault message
•SOAP over HTTP

AdvantagesanddisadvantagesofSOAP
Advantages

and

disadvantages

of

SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.3
Inter
ApplicationCommunication
Inter
-
Application

Communication

•Conventional distributed applications use distributed communication
technologies, e.g., CORBA, DCOM, Java/RMI, based on object RPC
(
ORPC
)

p
rotocols that attem
p
ted to marr
y
ob
j
ect orientation and
()ppyj
network protocols.
–ORPC request is an identifier or symbolic name that the server could use to
locatethetargetobjectinsidetheserverprocess
locate

the

target

object

inside

the

server

process
.
•Weaknesses
–Both ends of the communication link would need to be implemented under
(/CO/O)
the same distributed object model
(
Java
/
RMI or
CO
RBA
/
II
O
P
)
–Difficulty of getting these protocols to work over firewalls or proxy servers,
e.
g
., most firewalls are confi
g
ured to allow h
y
pertext transfer protocol
ggy
(HTTP) to pass across.
•To address the problem of overcoming proprietary systems running on
heterogeneousinfrastructuresWebservicesrelyonSOAPanXML
-
heterogeneous

infrastructures
,
Web

services

rely

on

SOAP
,
an

XML
based communication protocol for exchanging messages between
computers regardless of their operating systems, programming
environmentorobjectmodelframework
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
environment

or

object

model

framework
.
Slide 4.4
Topics
Topics
•Inter application communication
•SOAP as a messa
g
in
g

p
rotocol
ggp
•Structure of a SOAP message
SOAPcommunicationmodel

SOAP

communication

model
•SOAP fault message
•SOAP over HTTP

AdvantagesanddisadvantagesofSOAP
Advantages

and

disadvantages

of

SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.5
WhatisSOAP?
What

is

SOAP?
•SOAP is the standard messaging protocol used by Web services.
SOAP’s primary application is inter application communication. SOAP
codifies the use of XML as an encoding scheme for request and
tiHTTPftt
response parame
t
ers us
i
ng
HTTP
as a means
f
or
t
ranspor
t
.
Service provider
Service requestor
Application object
(client)
Application object
(service provider)
SOAP-based
middleware
SOAP-based
middleware
middleware
middleware
SOAP messages
exchanged on top of,
HTTP, SMTP, or other
transport
Converts procedure calls to/from XML
messages sent through HTTP or other
protocols
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
protocols
.
Slide 4.6
WhatisSOAP?(continued)
What

is

SOAP?

(continued)

•SOAP covers the following four main areas:
–A message formatfor one-way communication describing
how a message can be packed into an XML document.
–A descriptionof how a SOAP message should be
ttdiHTTP(fWb
bditti)SMTP
t
ranspor
t
e
d
us
i
ng
HTTP

(f
or
W
e
b
-
b
ase
d

i
n
t
erac
ti
on
)
or
SMTP

(for e-mail-based interaction).
A
tfl
thttbflldhi

A
se
t
o
f
ru
l
es
th
a
t
mus
t

b
e
f
o
ll
owe
d
w
h
en process
i
ng a
SOAP message and a simple classification of the entities
involvedinprocessingaSOAPmessage
involved

in

processing

a

SOAP

message
.
–A set of conventionson how to turn an RPC call into a
SOAPmessageandback
SOAP

message

and

back
.
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.7
SOAPasa
lightweightprotocol
SOAP

as

a

lightweight

protocol

•SOAP is a lightweight protocol
thatallowsapplicationstopass
that

allows

applications

to

pass

messages and data back and
forth between disparate systems
in a distributed environment,
enabling remote method
invocation.
•By lightweightwe mean that the
SOAP protocol possesses only
two fundamental properties. It
can:
can:
–It can send and receive HTTP
(or other) transport protocol
packets, and
–It can process XML messages.
•This can be contrasted with distributed object architecture (heavyweight)
tlhIttIt
ORBtlitlfCORBA
pro
t
oco
l
s suc
h
as
I
n
t
erne
t

I
n
t
e
r
-
ORB
pro
t
oco
l
, w
i
re pro
t
oco
l

f
or
CORBA
•A wire protocol specifies the form or shape of data to be exchanged between
ditliti/thiltttlithdbhihdt
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
di
spara
t
e app
li
ca
ti
ons
/
sys
t
ems, w
hil
e
t
ranspor
t
pro
t
oco
l

i
s me
th
o
d

b
y w
hi
c
h

d
a
t
a
is transferred from system to system
Slide 4.8
DistributedmessagingusingSOAP
Distributed

messaging

using

SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.9
Topics
Topics
•Inter application communication
•SOAP as a messa
g
in
g

p
rotocol
ggp
•Structure of a SOAP message
SOAPcommunicationmodel

SOAP

communication

model
•SOAP fault message
•SOAP over HTTP

AdvantagesanddisadvantagesofSOAP
Advantages

and

disadvantages

of

SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.10
SOAPmessages
SOAP

messages
•SOAP is based on message exchanges.
•Messages are seen as envelopeswhere
the application encloses the data to be
sent.
•A SOAP message consists of a SOAP of
an <Envelope> element containing an
optional <Header> and a mandatory
<Body> element.
•The contents of these elements are
SOAP envelo
p
e
application defined and not a part of the
SOAP specifications.
•A SOAP <Header> contains blocks of
p
SOAP header
header block
information relevant to how the message is
to be processed. This helps pass
information in SOAP messa
g
es that is not
g
application payload.
•The SOAP <Body> is where the main end-
to-end information conve
y
ed in a SOAP
SOAP body
body block
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
y
message must be carried.
Slide 4.11
SOAPenvelopeandheader
<env:Envelope
xmlns:env“http://wwww
3
org/
2003
/
05
/soap
envelope”
SOAP

envelope

and

header
xmlns:env
=
“http://www
.
w
3
.
org/
2003
/
05
/soap
-
envelope”
env:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
……
</env:Envelope>
ExampleofSOAPenvelope
</env:Envelope>
<env:Envelope
Example

of

SOAP

envelope
<Envelope> element describes what’s in the message and how to process it
<env:Envelope

xmlns:env=“http://www.w3.org/2003/05/soap-envelope” >

<env:Header>
<
tx:transaction-id
xmlns:tx=”http://www.transaction.com/transaction”
env:mustUnderstand=”true”>
512
512

</tx:transaction-id>
<notary:token xmlns:notary=”http://www.notarization-services.com/token”
env:mustUnderstand=”true”>
3
GRAAL-5YF
3
</notary:token>
</env:Header>
……………
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
</env:Envelope>
Example of SOAP header
Slide 4.12
SOAPIntermediaries
SOAP

Intermediaries
•SOAP headers have been
designed in anticipation of
participationofotherSOAP
participation

of

other

SOAP

processing nodes –called SOAP
intermediaries–along a
message's pathfrom an initial
SOAP sender to an ultimate
SOAPreceiver
SOAP

receiver
.
•A SOAP message travels along
the messa
g
e
p
ath from a sender
gp
to a receiver.
•All SOAP messages start with an
iitildhihtth
i
n
iti
a
l
sen
d
er, w
hi
c
h
crea
t
es
th
e
SOAP message, and end with an
ultimatereceiver.
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
ultimate

receiver.
Slide 4.13
Example of SOAP header with
<?mlersion"
1
0
"encoding"UTF
8
"?>
message routing
<?
x
ml
v
ersion
=
"
1
.
0
"

encoding
=
"UTF
-
8
"?>
<env:Envelope
xmlns:env=“http://www.w3.org/2003/05/soap-envelope”>
<env:Header>
<env:Header>
<m:order
xmlns:m="http://www.plastics_supply.com/purchase-order"
env:role=
"
http://wwww
3
org/
2003
/
05
/soap
-
envelope/role/next
"
env:role=http://www
.
w
3
.
org/
2003
/
05
/soap
-
envelope/role/next
env:mustUnderstand="true">
<m:order-no >uuid:0411a2daa</m:order-no>
<m:date>
2004
-
11
-
8
</m:date>
<m:date>
2004
11
8
</m:date>
</m:order>
<n:customer xmlns:n="http://www.supply.com/customers"
env:role="htt
p
://www.w3.or
g
/2003
/
05
/
soa
p
-envelo
p
e/role/next"
p
g
p
p
env:mustUnderstand="true">
<n:name> Marvin Sanders </n:name>
</n:customer >
</env:Header>
<env:Body>
<--Payload element goes here -->
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
</env:Body>
</env:Envelope>
Slide 4.14
TheSOAPBody
The

SOAP

Body
•The SOAP body is the area of the SOAP message, where the
application specific XML data (payload) being exchanged in the
messageisplaced.
message

is

placed.
•The <Bod
y
> elementmust be
p
resent and is an immediate child of the
y
p
envelope. It may contain a number of child elements, called body
entries, but it may also be empty. The <Body> elementcontains either
ofthefollowing:
of

the

following:
–Application-specific datais the information that is exchanged with a Web
service. The SOAP <Body> is where the method call information and its
ltdtddItihthtthdlli
re
l
a
t
e
d
argumen
t
s are enco
d
e
d
.
It

i
s w
h
ere
th
e response
t
o a me
th
o
d
ca
ll

i
s
placed, and where error information can be stored.

A fault messa
g
eis used onl
y
when an error occurs.
g
y
•A SOAP message may carry either application-specific data or a fault,
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
but not both.
Slide 4.15
ExampleSOAPMessage
Example

SOAP

Message
<?xmlversion
='
1
.
0
'
?>
<?xml

version
1
.
0

?>
<env:Envelope xmlns:env="http://www.w3.org/2002/06/soap-envelope" >
<env:Header>
<t:transactionID
Header
Envelope
<t:transactionID
xmlns:t="http://intermediary.example.com/procurement"
env:role="http://www.w3.org/2002/06/soap-envelope/role/next"
env:mustUnderstand="true" >
57539
</t:transactionID>
Header

</t:transactionID>
</env:Header>
<env:Body>
<m:orderGoods
Blocks
<m:orderGoods

env:encodingStyle="http://www.w3.org/2002/06/soap-encoding"
xmlns:m="http://example.com/procurement">
<m:productItem>
<name>ACME Softener</name>
</m:productItem>
Body
</m:productItem>

<m:quantity>
35
</m:quantity>
</m:orderGoods>
</env:Body>
</env:Body>
</env:Envelope>
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.16
Topics
Topics
•Inter application communication

SOAPasamessagingprotocol
SOAP

as

a

messaging

protocol
•Structure of a SOAP message
•SOAP communication model

SOAPfaultmessage
SOAP

fault

message
•SOAP over HTTP
•Advantages and disadvantages of SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.17
The SOAP Communication Model
•SOAP communication model is defined by its encoding style and its
communication style
Encodingstyleareabouthowapplicationsondifferentplatformsshare

Encoding

style

are

about

how

applications

on

different

platforms

share

and exchange data, although they may have different data types

SOAPencodingrulesareidentifiedbytheURI
SOAP

encoding

rules

are

identified

by

the

URI

“http://www.w3.org/2003/05/soap-encoding”
•SOAP supports two possible communication styles:
–remote procedure call (RPC) and
–document (or message).
Request
for
quote
Request
for
quote
Web Service Definitions
Ri
Request
for
quote
Request
for
quote
Web Service Definitions
Ri
R
ece
i
ve
Check
Database
R
ece
i
ve
Check
Database
Quote
document
Quote
document
Business Process Flow
Send
Quote
document
Quote
document
Business Process Flow
Send
Send
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
RPC-style (synchronous) interactionDocument-style (asynchronous) interaction
Slide 4.18
RPC
styleSOAPServices
RPC
-
style

SOAP

Services
•A remote procedure call (RPC)-style Web service appears as a remote
object to a client application. The interaction between a client and an
RPC
-
styleWebservicecentersaroundaservice
-
specificinterface
RPC
style

Web

service

centers

around

a

service
specific

interface
.
Clients express their request as a method call with a set of arguments,
which returns a response containing a return value.
SOAP envelope
SOAP envelope
SOAP body
Method name
orderGoods
SOAP body
Method return
orderGoods
Input parameter 1
product item
Return value
order id
Input parameter 2
quantity
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.19
RPC
stylewebservices
<env:Envelope
xmlns:SOAP=“http://www.w3.org/2003/05/soap-envelope”
l"htt//ltil/dt
i"
RPC
-
style

web

services
xm
l
ns:m=
"htt
p:
//
www.p
l
as
ti
cs
_
supp
l
y.com
/
pro
d
uc
t
-pr
i
ces
">
<env:Header>
<tx:Transaction-id
xmlns:t=”http://www.transaction.com/transactions”
env:mustUnderstand='
1
'>
env:mustUnderstand='
1
'>

512
</tx:Transaction-id>
</env:Header>
<env:Body>
<env:Body>
<m:GetProductPrice>
<product-id> 450R6OP </product-id >
</m:GetProductPrice >
<
/e
nv
:
B
ody>
Method name
Method parameter
/e:ody
</env:Envelope>
<env:Envelope
xmlns:SOAP=“http://www.w3.org/2003/05/soap-envelope”
Listing 4.5: Example of RPC-style SOAP body
xmlns:m="http://www.plastics_supply.com/product-prices">
<env:Header>
<--! –Optional context information -->
</env:Header>
Returnedvalue
<env:Body
>
<m:GetProductPriceResponse>
<product-price> 134.32 </product-price>
</m:GetProductPriceResponse>
</Bd>
Returned

value
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
</
env:
B
o
d
y
>
</env:Envelope>
Listing 4.6: Example of RPC-style SOAP response message
Slide 4.20
Document(Message)
styleSOAPServices
Document

(Message)
-
style

SOAP

Services
•In the document-style of messaging, the SOAP <Body> contains an
XML document fragment. The <Body> element reflects no explicit XML
structure.
•The SOAP run-time environment accepts the SOAP <Body> element
as it stands and hands it over to the application it is destined for
unchangedTheremayormaynotbearesponseassociatedwiththis
unchanged
.
There

may

or

may

not

be

a

response

associated

with

this

message.
SOAP envelope
SOAP body
SOAP envelope
SOAP body
PurchaseOrder
document
productitem
Acknowledgement
document
-
product

item
-quantity
-order id
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.21
Exampleofdocument
styleSOAPbody
<env:Envelope
xmlns:SOAP=“http://www.w3.org/2003/05/soap-envelope”>
Example

of

document
-
style

SOAP

body
<env:Header>
<tx:Transaction-id
xmlns:t=”http://www.transaction.com/transactions”
env:mustUnderstand='
1
'>
env:mustUnderstand='
1
'>

512
</env:Header>
<env:Body>
<po:PurchaseOrderoderDate=

2004
-
12
-
02

<po:PurchaseOrder

oderDate=
2004
12
02
xmlns:m="http://www.plastics_supply.com/POs">
<po:from>
<po:accountName> RightPlastics </po:accountName>
<
po:accou
n
t
N
u
m
be
r> P
SC
-
03
4
3
-
0
2 <
/po:accou
n
t
N
u
m
be
r
>
po:accoutubeSC
033
0
/po:accoutube
</po:from>
<po:to>
<po:supplierName> Plastic Supplies Inc. </po:supplierName>
<
p
o:su
pp
lierAddress> Yara Valle
y
Melbourne </
p
o:su
pp
lierAddress
>
pppyppp
</po:to>
<po:product>
<po:product-name> injection molder </po:product-name>
<po:product-model> G-100T </po:product-model>
<po:quantity> 2 </po:quantity
>
</po:product>
</ po:PurchaseOrder >
</env:Body>
/l
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
<
/
env:Enve
l
ope
>
Example of document-style SOAP body
Slide 4.22
Topics
Topics
•Inter application communication
•SOAP as a messa
g
in
g

p
rotocol
ggp
•Structure of a SOAP message
SOAPcommunicationmodel

SOAP

communication

model
•SOAP fault message
•SOAP over HTTP

AdvantagesanddisadvantagesofSOAP
Advantages

and

disadvantages

of

SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.23
SOAPFaultelement
SOAP

Fault

element

SOAPprovidesamodelforhandlingfaultsarise.
SOAP

provides

a

model

for

handling

faults

arise.

•It distinguishes between the conditions that result in a fault, and the ability to
signal that fault to the originator of the faulty message or another node. The
SOAP<Bd>ithlhfltiftiild
SOAP

<B
o
d
y
>

i
s
th
e p
l
ace w
h
ere
f
au
lt

i
n
f
orma
ti
on
i
s p
l
ace
d
.
•Use special-purpose element called
env:Fault, which is predefined by SOAP
s
p
ecification
p
•Within the
env:Fault
element contains two required sub elements:
env:Code
and env:Reason, and an optional sub-element called
env:Detail
containing
application
specificinformation
application
-
specific

information
•The
env:Code
contains two sub elements, a required element called
env:Value
and an optional one called
env:Subcode
•env:Reasonsub-element contains human-readable description that explains fault
situation
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.24
<env:Envelope
xmlns:SOAP=“http://www.w3.org/2003/05/soap-envelope”
xmlns:m="http://www.plastics_supply.com/product-prices">
<env:Header>
<env:Header>
<tx:Transaction-id
xmlns:t=”http://www.transaction.com/transactions”
env:mustUnderstand='1'>
512
512

</tx:Transaction-id>
</env:Header>
<env:Body>
<env:Fault
>
Sender incorrectly formed message (syntax error)
<env:Code>
<env:Value>env:Sender</env:Value>
<env:Subcode>
<env:Value> m:InvalidPurchaseOrder </env:Value>
Cause of failure to process request
</env:Subcode>
</env:Code>
<env:Reason>
<env:Text xml:lang="en-UK“>Specified product did not exist</env:Text>
/
<
/
env:Reason
>
<env:Detail>
<err:myFaultDetails
xmlns:err="http://www.plastics_supply.com/faults">
<>Pdtbtiilidht
<
err:message
>

P
ro
d
uc
t
num
b
er con
t
a
i
ns
i
nva
lid
c
h
arac
t
ers
</err:message>
<err:errorcode> 129 </err:errorcode>
</err:myFaultDetails>
</env:Detail>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Example of SOAP Fault message corresponding to Listing 4.5
Slide 4.25
Topics
Topics
•Inter application communication
•SOAP as a messa
g
in
g

p
rotocol
ggp
•Structure of a SOAP message

SOAPcommunicationmodel

SOAP

communication

model
•SOAP fault message
•SOAP over HTTP

AdvantagesanddisadvantagesofSOAP
Advantages

and

disadvantages

of

SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.26
SOAPandHTTP
SOAP

and

HTTP
A binding of SOAP to a transport protocol is
a description of how a SOAP message is to
be sent usin
g
that trans
p
ort
p
rotocol.
SOAP envelope
SOAPheader
HTTP POST
gpp
The typical binding for SOAP is HTTP.
SOAP can use GET or POST. With GET,
thtitSOAPbtth
Transactional
context
SOAP
bd
th
e reques
t

i
s no
t
a
SOAP
message
b
u
t

th
e
response is a SOAP message, with POST
both request and response are SOAP
SOAP
b
o
d
y
In
p
ut
p
arameter 1
Name of procedure
messages (in version 1.2, version 1.1
mainly considers the use of POST).

SOAPusesthesameerrorandstatus
pp
Input parameter 2
SOAP

uses

the

same

error

and

status

codes as those used in HTTP so that HTTP
responses can be directly interpreted by a
SOAPmodule
SOAP

module
.
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.27
RPCcallusingSOAPoverHTTP
RPC

call

using

SOAP

over

HTTP
SOAP envelope
HTTP Post
SOAP envelope
SOAP header
Transactional
context
Siid
Sit
SOAP body
Name of the
procedure
S
erv
i
ce prov
id
e
r
SOAP
en
g
ine
HTTP
en
g
ine
S
erv
i
ce reques
t
o
r
HTTP
en
g
ine
SOAP
en
g
ine
Input parameter 1
Input parameter 2
g
Service implementation
(
other tiers
)
g
g
Client implementation (other
tiers
)
g
SOAP envelope
SOAP envelope
HTTP Post
()
)
SOAP envelope
SOAP header
transactional
context
SOAP envelope
SOAP header
Transactional
context
SOAP body
return
parameter
SOAP body
Return
parameter
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
parameter
Slide 4.28
POST /Purchase Order HTTP/1.1
Host: http://www.plastics_supply.com <! –Service provider -->
Ctt
Tliti/+l
C
on
t
en
t
-
T
ype:app
li
ca
ti
on
/
soap
+
xm
l
;
charset = “utf-8”
Content-Length: nnnn
<?xml version="1.0" ?>
<env:Envelope
xmlns:SOAP=

http://wwww
3
org/
2003
/
05
/soap
-
envelope

xmlns:SOAP=http://www
.
w
3
.
org/
2003
/
05
/soap
envelope

xmlns:m="http://www.plastics_supply.com/product-prices">
<env:Header>
<tx:Transaction
-
id
<tx:Transaction
id

xmlns:t=”http://www.transaction.com/transactions”
env:mustUnderstand='1'>
512
</tx:Transaction-id>
</env:Header>
<env:Body
>
<m:GetProductPrice>
<product-id> 450R6OP </product-id >
</m:GetProductPrice >
</env:Body
>
</env:Envelope>
Liti
4
9
SlHTTP/SOAPldtfLiti
4
5
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Li
s
ti
ng
4
.
9

S
amp
l
e
HTTP/SOAP
enve
l
ope
d
reques
t
o
f

Li
s
ti
ng
4
.
5
Slide 4.29
HTTP/1.1 200 OK
Content-Type:application/soap+xml;
charset=

utf
-
8

charset

=

utf
8
Content-Length: nnnn
<?xmlversion="
1
0
"?>
<?xml

version="
1
.
0
"

?>
<env:Envelope
xmlns:SOAP=“http://www.w3.org/2003/05/soap-envelope”
///
xmlns:m="http:
//
www.plastics
_
supply.com
/
product-prices">
<env:Header>
<
--! –Optional context information -->
</env:Header>
<env:Body>
<m:GetProductPriceResponse>
<m:GetProductPriceResponse>

<product-price> 134.32 </product-price>
</m:GetProductPriceResponse>
</env:Body>
</env:Body>
</env:Envelope>
Listing
4
10
RPCreturnsentbythepurchaseorderserviceapplication
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Listing

4
.
10

RPC

return

sent

by

the

purchase

order

service

application
Slide 4.30
Topics
Topics
•Inter application communication

SOAPasamessagingprotocol
SOAP

as

a

messaging

protocol
•Structure of a SOAP message
•SOAP communication model

SOAPfaultmessage
SOAP

fault

message
•SOAP over HTTP
•Advantages and disadvantages of SOAP
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
Slide 4.31
AdvantagesanddisadvantagesofSOAP
Advantages

and

disadvantages

of

SOAP
•Advantages of SOAP are:
–Simplicity: Based on highly-structured format of XML
–Portability: No dependencies on underlying platform
–Firewall friendliness: By posting data over HTTP
–Use of open standards: text-based XML standard

Interoperability: Built on open technologies (XML and HTTP)
–Universal acceptance. Most widely accepted message
communicationstandard
communication

standard
•Disadvantages of SOAP are:
ThliHTTPliitdltt/

T
oo muc
h
re
li
ance on
HTTP
:
li
m
it
e
d
on
l
y
t
o reques
t/
response
model and HTTP’s slow protocol causes bad performance

Statelessness:difficultfortransactionalandbusinessprocessing

Statelessness:

difficult

for

transactional

and

business

processing

applications

Serialization b
y
value and not b
y
reference: im
p
ossible to refer or
Michael P. Papazoglou, Web Services, 1st
Edition, © Pearson Education Limited 2008
yyp
point to external data source