Difference between SOAP and HTTP protocol?
What is the difference between the SOAP and HTTP protocol. When we say "SOAP over HTTP", what does that mean.?
Solution 1:
You can serve any content over HTTP such as HTML, images, sound, video, etc. SOAP is an XML-based encoding of messages that are typically sent over HTTP, but could be sent over SMTP or even FTP, although I've never seen such a system used in a production environment.
Just like HTTP sits on top of TCP/IP, SOAP sits on top of HTTP. Layers on top of layers...
If you look at a SOAP request, you can see both layers, with the HTTP headers at the top, followed by the SOAP message. From the w3schools SOAP tutorial:
--------- HTTP portion of the message ------
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
--------- SOAP portion of the message ------
<?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>
More reading for you:
- http://en.wikipedia.org/wiki/HTTP
- http://en.wikipedia.org/wiki/SOAP
Solution 2:
To interact with server, request should be in XML encoded format using SOAP. But in case of HTTP, request can be sent in HTML, Image, video format etc. SOAP request are sent using HTTP protocol.
Solution 3:
SOAP stands for Simple Object Access protocol. It is XML based used for sending and receiving messages. It is defined with in XML.
Example.
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.example/2003/05/soap-envelope/"
soap:encodingStyle="http://www.example.com/2003/05/soap-encoding">
<soap:Body>
<m:GetPriceResponse xmlns:m="http://www.example.com/prices">
<m:Price>1.90</m:Price>
</m:GetPriceResponse>
</soap:Body>
</soap:Envelope>
smtp stands for Simple Mail Transfer Protocol. Simple Mail Transfer Protocol is a way to transfer email reliably and efficiently. smtp is used to send mail to the recipient's mailbox,thus using various methods to access the emails in his mailbox. smtp by default uses tcp port 25. The protocol for mail submission is the same, but uses port 587. smtp connections secured by [SSL], known as smtps, default to port 465 (nonstandard, but sometimes used for legacy reasons). We can send messages synchronously or asynchronously. Sessions can be automatically managed.
SOAP is language dependent, But SMTP is Language independent. SOAP is mainly used for XML webservices. SMTP is also using http protocol to get or post information.