Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or...

31
Slide 4.1 Chapter 4 SOAP: Simple Object Access Protocol ology SOAP: Simple Object Access Protocol echno vices: s & T e Serv ciples Web Princ Mike P. Papazoglou [email protected] Michael P. Papazoglou, Web Services, 1 st Edition, © Pearson Education Limited 2008

Transcript of Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or...

Page 1: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.1

Chapter 4SOAP: Simple Object Access Protocol

olog

y SOAP: Simple Object Access Protocolec

hno

vice

s:s

& T

eS

erv

cipl

esW

eb

Prin

c

Mike P. Papazoglou [email protected]

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 2: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.2

TopicsTopics

• Inter application communication• SOAP as a messaging protocolg g p• Structure of a SOAP message

SOAP communication model• SOAP communication model• SOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAPAdvantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 3: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.3

Inter Application CommunicationInter-Application Communication

• Conventional distributed applications use distributed communication technologies, e.g., CORBA, DCOM, Java/RMI, based on object RPC (ORPC) protocols that attempted to marry object orientation and ( ) p p y jnetwork protocols. – ORPC request is an identifier or symbolic name that the server could use to

locate the target object inside the server processlocate 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 CORBA/IIOP)

– Difficulty of getting these protocols to work over firewalls or proxy servers, e.g., most firewalls are configured to allow hypertext transfer protocol g g y(HTTP) to pass across.

• To address the problem of overcoming proprietary systems running on heterogeneous infrastructures Web services rely on SOAP an XML-heterogeneous infrastructures, Web services rely on SOAP, an XMLbased communication protocol for exchanging messages between computers regardless of their operating systems, programming environment or object model framework

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

environment or object model framework.

Page 4: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.4

TopicsTopics

• Inter application communication• SOAP as a messaging protocolg g p• Structure of a SOAP message

SOAP communication model• SOAP communication model• SOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAPAdvantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 5: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.5

What is SOAP?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

t i HTTP f t tresponse parameters using HTTP as a means for transport.

Service providerService requestor

Application object(client)

Application object(service provider)

SOAP-based middleware

SOAP-based middlewaremiddleware middlewareSOAP 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.

Page 6: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.6

What is SOAP? (continued)What is SOAP? (continued)

• SOAP covers the following four main areas:– A message format for one-way communication describing

how a message can be packed into an XML document.– A description of how a SOAP message should be

t t d i HTTP (f W b b d i t ti ) SMTPtransported using HTTP (for Web-based interaction) or SMTP (for e-mail-based interaction).A t f l th t t b f ll d h i– A set of rules that must be followed when processing a SOAP message and a simple classification of the entities involved in processing a SOAP messageinvolved in processing a SOAP message.

– A set of conventions on how to turn an RPC call into a SOAP message and backSOAP message and back.

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 7: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.7

SOAP as a lightweight protocolSOAP as a lightweight protocol • SOAP is a lightweight protocol

that allows applications to passthat allows applications to pass messages and data back and forth between disparate systems in a distributed environment, enabling remote method invocation.

• By lightweight we 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) t l h I t t I t ORB t l i t l f CORBAprotocols such as Internet Inter-ORB protocol, wire protocol for CORBA

• A wire protocol specifies the form or shape of data to be exchanged between di t li ti / t hil t t t l i th d b hi h d t

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

disparate applications/systems, while transport protocol is method by which data is transferred from system to system

Page 8: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.8

Distributed messaging using SOAPDistributed messaging using SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 9: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.9

TopicsTopics

• Inter application communication• SOAP as a messaging protocolg g p• Structure of a SOAP message

SOAP communication model• SOAP communication model• SOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAPAdvantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 10: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.10

SOAP messagesSOAP messages

• SOAP is based on message exchanges.• Messages are seen as envelopes where

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 envelope

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 messages that is not gapplication payload.

• The SOAP <Body> is where the main end-to-end information conveyed in a SOAP

SOAP body

body block

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

ymessage must be carried.

Page 11: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.11

SOAP envelope and header<env:Envelope

xmlns:env “http://www w3 org/2003/05/soap envelope”

SOAP envelope and header

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

……</env:Envelope> Example of SOAP envelope</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”>

512512 </tx:transaction-id>

<notary:token xmlns:notary=”http://www.notarization-services.com/token”env:mustUnderstand=”true”>

3GRAAL-5YF3</notary:token>

</env:Header>……………

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

</env:Envelope> Example of SOAP header

Page 12: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.12

SOAP IntermediariesSOAP Intermediaries

• SOAP headers have been designed in anticipation of participation of other SOAPparticipation of other SOAP processing nodes – called SOAP intermediaries – along a message's path from an initial SOAP sender to an ultimate SOAP receiverSOAP receiver.

• A SOAP message travels along the message path from a sender g pto a receiver.

• All SOAP messages start with an i iti l d hi h t thinitial sender, which creates the SOAP message, and end with an ultimate receiver.

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

ultimate receiver.

Page 13: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.13

Example of SOAP header with

<? ml ersion "1 0" encoding "UTF 8"?>

message routing<?xml version="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://www w3 org/2003/05/soap-envelope/role/next"env:role= http://www.w3.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="http://www.w3.org/2003/05/soap-envelope/role/next"p g p penv: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>

Page 14: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.14

The SOAP BodyThe SOAP Body

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

• The <Body> element must be present and is an immediate child of the y penvelope. It may contain a number of child elements, called body entries, but it may also be empty. The <Body> element contains either of the following:of the following:– Application-specific data is the information that is exchanged with a Web

service. The SOAP <Body> is where the method call information and its l t d t d d It i h th t th d ll irelated arguments are encoded. It is where the response to a method call is

placed, and where error information can be stored.– A fault message is used only 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.

Page 15: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.15

Example SOAP MessageExample SOAP Message<?xml version='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:transactionIDxmlns: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

Page 16: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.16

TopicsTopics

• Inter application communication• SOAP as a messaging protocolSOAP as a messaging protocol• Structure of a SOAP message• SOAP communication model• SOAP fault messageSOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 17: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.17

The SOAP Communication Model• SOAP communication model is defined by its encoding style and its

communication style Encoding style are about how applications on different platforms share• Encoding style are about how applications on different platforms share and exchange data, although they may have different data types

• SOAP encoding rules are identified by the URISOAP 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

R i

Request for

quote

Request for

quote

Web Service Definitions

R iReceive

Check

DatabaseReceive

Check

Database

Quotedocument

Quotedocument

Business Process Flow

Send

Quotedocument

Quotedocument

Business Process Flow

SendSend

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

RPC-style (synchronous) interaction Document-style (asynchronous) interaction

Page 18: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.18

RPC style SOAP ServicesRPC-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-style Web service centers around a service-specific interfaceRPC 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 nameorderGoods

SOAP body

Method returnorderGoods

Input parameter 1product item

Return valueorder id

Input parameter 2quantity

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 19: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.19

RPC style web services<env:Envelope xmlns:SOAP=“http://www.w3.org/2003/05/soap-envelope” l "htt // l ti l / d t i "

RPC-style web services

xmlns:m="http://www.plastics_supply.com/product-prices"><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 ></env:Body>

Method nameMethod 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>

Returned value<env:Body><m:GetProductPriceResponse>

<product-price> 134.32 </product-price></m:GetProductPriceResponse>

</ B d >

Returned value

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

</env:Body></env:Envelope>

Listing 4.6: Example of RPC-style SOAP response message

Page 20: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.20

Document (Message) style SOAP ServicesDocument (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 unchanged There may or may not be a response associated with thisunchanged. There may or may not be a response associated with this message.

SOAP envelope

SOAP body

SOAP envelope

SOAP body

PurchaseOrderdocument

product item

Acknowledgementdocument

-product item-quantity

-order id

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 21: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.21

Example of document style SOAP body<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:PurchaseOrder oderDate=”2004-12-02”<po:PurchaseOrder oderDate= 2004 12 02xmlns:m="http://www.plastics_supply.com/POs"><po:from>

<po:accountName> RightPlastics </po:accountName> <po:accountNumber> PSC-0343-02 </po:accountNumber>po:accou t u be SC 03 3 0 /po:accou t u be

</po:from><po:to>

<po:supplierName> Plastic Supplies Inc. </po:supplierName><po:supplierAddress> Yara Valley Melbourne </po:supplierAddress>p pp y p pp

</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:Envelope>Example of document-style SOAP body

Page 22: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.22

TopicsTopics

• Inter application communication• SOAP as a messaging protocolg g p• Structure of a SOAP message

SOAP communication model• SOAP communication model• SOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAPAdvantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 23: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.23

SOAP Fault elementSOAP Fault element• SOAP provides a model for handling faults arise.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 <B d > i th l h f lt i f ti i l dSOAP <Body> is the place where fault information is placed.

• Use special-purpose element called env:Fault, which is predefined by SOAP specificationp

• Within the env:Fault element contains two required sub elements: env:Codeand env:Reason, and an optional sub-element called env:Detail containing application specific informationapplication-specific information

• The env:Code contains two sub elements, a required element called env:Valueand an optional one called env:Subcode

• env:Reason sub-element contains human-readable description that explains fault situation

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 24: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

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'> 512512

</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">

< > P d t b t i i lid h t<err:message> Product number contains invalid characters </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 2008Example of SOAP Fault message corresponding to Listing 4.5

Page 25: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.25

TopicsTopics

• Inter application communication• SOAP as a messaging protocolg g p• Structure of a SOAP message• SOAP communication model• SOAP communication model• SOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAPAdvantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 26: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.26

SOAP and HTTPSOAP and HTTP

A binding of SOAP to a transport protocol is a description of how a SOAP message is to be sent using that transport protocol.

SOAP envelopeSOAP header

HTTP POST

g p p The typical binding for SOAP is HTTP. SOAP can use GET or POST. With GET,

th t i t SOAP b t th

Transactionalcontext

SOAP b dthe request is not a SOAP message but the response is a SOAP message, with POST both request and response are SOAP

SOAP body

Input parameter 1

Name of procedure

messages (in version 1.2, version 1.1 mainly considers the use of POST).

SOAP uses the same error and status

p p

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 SOAP moduleSOAP module.

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 27: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.27

RPC call using SOAP over HTTPRPC call using SOAP over HTTPSOAP envelope

HTTP Post

SOAP envelope

SOAP header

Transactional context

S i idS i t

SOAP body

Name of the procedure

Service provider

SOAP engine

HTTP engine

Service requestor

HTTP engine

SOAP engine

Input parameter 1

Input parameter 2g

Service implementation (other tiers)

gg

Client implementation (other tiers)

g

SOAP envelopeSOAP 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

Page 28: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.28

POST /Purchase Order HTTP/1.1Host: http://www.plastics_supply.com <! – Service provider -- >C t t T li ti / + lContent-Type:application/soap+xml; charset = “utf-8”Content-Length: nnnn

<?xml version="1.0" ?><env:Envelope xmlns:SOAP=“http://www w3 org/2003/05/soap-envelope”xmlns:SOAP= http://www.w3.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>

Li ti 4 9 S l HTTP/SOAP l d t f Li ti 4 5

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Listing 4.9 Sample HTTP/SOAP enveloped request of Listing 4.5

Page 29: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.29

HTTP/1.1 200 OKContent-Type:application/soap+xml; charset = “utf-8”charset = utf 8Content-Length: nnnn

<?xml version="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 RPC return sent by the purchase order service application

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Listing 4.10 RPC return sent by the purchase order service application

Page 30: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.30

TopicsTopics

• Inter application communication• SOAP as a messaging protocolSOAP as a messaging protocol• Structure of a SOAP message• SOAP communication model• SOAP fault messageSOAP fault message• SOAP over HTTP• Advantages and disadvantages of SOAP

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

Page 31: Chapter 4 SOAP: Simple Object Access Protocol logy & T Sermcs/courses/219451/slides/04.pdf · (or other) transport protocol packets, and – It can process XML messages. • This

Slide 4.31

Advantages and disadvantages of SOAPAdvantages 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

communication standardcommunication standard

• Disadvantages of SOAP are:T h li HTTP li it d l t t/– Too much reliance on HTTP: limited only to request/response model and HTTP’s slow protocol causes bad performance

– Statelessness: difficult for transactional and business processing– Statelessness: difficult for transactional and business processing applications

– Serialization by value and not by reference: impossible to refer or

Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008

y y ppoint to external data source