What Is SOAP in Web Services?

0
33
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

Simple Object Access Protocol(SOAP): SOAP is the messaging standard for Web Services.

As per w3c SOAP is defined as SOAP is a lightweight protocol for exchange of information in a decentralized,distributed environment. It is an XML based protocol that consists of three parts:
an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined datatypes, and a convention for representing remote procedure calls and responses.

The SOAP is universally accepted ,standard transport protocol for message processed in web services.
Mainly SOAP has 3 parts–
1. SOAP envelope
2. SOAP header
3. And SOAP body


SOAP Architecture


SOAP is also available in two different flavors-
1. SOAP v1.1
2. SOAP v1.2

But both the version follow the same structure.
SOAP envelope:
SOAP envelope is a wrapper which is used to hold all child nodes inside the message.
SOAPĀ headerĀ holds all the meta information.Using this information SOAP can provides more information regarding delivery,addressing information,correlation data and processing of the message. As it is optional , it becomes stateless.

Body:
Body is the part of SOAP where the original message are passed. This is called message payload.

Advantages:
1.SOAP is considered as standard protocol for web service communication but can be extended to WS-* like WS-Security,WS-Addressing etc.
2.SOAP message can be transmitted over HTTP,HTTPS,JMS,SMTP etc
3.Relatively easy to understand and formation.

Disadvantages of SOAP:
1. It is stateless
2. It faces majorly performance problem as large XML needs to processed
3. Time consuming
4. More complex

An Example of SOAP request:

POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap xml; charset=utf-8
Content-Length: nnn

<?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.example.org/stock”>
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>

</soap:Envelope>


An Example for SOAP response looks like:

HTTP/1.1 200 OK
Content-Type: application/soap xml; charset=utf-8
Content-Length: nnn

<?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.example.org/stock”>
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>

</soap:Envelope>

 

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here