SOAP vs HTTP | Difference between SOAP and HTTP protocols
This page compares SOAP vs HTTP and mentions difference between SOAP and HTTP protocols. Let us understand basics of SOAP and HTTP protocols.
• SOAP is the short form of Simple Object Access Protocol.
• It uses XML messaging syntax to exchange information among computers via internet.
• SOAP can extend HTTP for XML messaging.
• It provides data transport for web services. It can exchange complete documents or call remote procedure. It can be used to broadcast a message.
• SOAP is platform and language independent.
• SOAP is not tied to any particular transport protocol. Hence SOAP messages can be transported via SMTP, HTTP, FTP, MQSeries or MSMQ. Out of these, HTTP remains the most popular SOAP transport protocol.
• The figure-1 depicts SOAP protocol messages between sender and receiver.
• As shown SOAP message contains following elements viz. envelope, header, body and fault.
• Envelope: It defines start and end of the message. It is mandatory element.
• Header: It contains any optional attributes of the message used in processing the message, either at intermediate point or at end point. It is optional.
• Body: It contains XML data comprising the message being sent. It is mandatory element.
• Fault: It is optional element which provides information about errors that occur while processing the message.
• SOAP encoding: It includes built-in set of rules for encoding data types. SOAP data types are divided into two broad categories viz. scalar and compound. Scalar types contain exactly one value such as last name, price or product description. Compound types contain multiple values such as PO or stock quote list. Compound types are subdivided into arrays and structs. Scalar types include strings, floats, doubles, integers, date, time, boolean, decimal, binary, long, short, byte etc.
The figure-2 depicts, HTTP connection between client (web user) and web server. It uses normal IP header for routing of packets and data are not encrypted before transmission. HTTP protocol consists of two elements viz. HTTP header and HTTP body. When HTTP body consists of pure XML document only and nothing else then it is called as plain HTTP.
HTTP is short form of Hypertext Transfer Protocol. It is application protocol used for distributed, collaborative and hypermedia information systems. HTTP is foundation of WWW (World Wide Web). HTTP is the protocol used for exchanging and transferring hypertext between nodes.
The secured version of HTTP is called as HTTPS.
Refer HTTP vs HTTPS>> for difference between HTTP and HTTPS.
Difference between SOAP and HTTP
Following table mentions difference between SOAP and HTTP protocols.
|Full form is Simple Object Access Protocol.||Full form is Hyper Text Transfer Protocol.|
|It supports web socket or WS-addressing, WS-security adn SOAP headers.||HTTP message flows never use web socket or WS-addressing, WS-security, SWA or MTOM.|
|A common SOAP has logical tree format which are independent of bitstream format.||HTTP is something which uses different standards viz. REST or XML-RPC.|
|Runtime checking against WSDL is allowed in SOAP.||Runtime checking against WSDL is not available in HTTP.|
|Automatic processing of SOAP with attachments (SwA) is possible.||In HTTP, message flows which interact with web services only.|
|Automatic processing of message transmission optimization mechanism (MTOM) is also feasible.||HTTP nodes can process SwA messages also, but it must use the MIME message domain and design flow should be done to handle the attachments explicitly. Custom logic to extract and parse the SOAP should be written.|
|Function: It is a protocol to exchange XML based messages. It uses HTTP to transport these messages.||HTTP is a communication protocol which transports messages over a network.|
|It supports WS-security and SSL.||It is not secured and hence its alternative HTTPS is used to avail security.|
Conclusion: From above comparison between SOAP vs HTTP, we can conclude as follows.
➤HTTP sits on top of TCP/IP where as SOAP sits on top of HTTP.
➤HTTP contents include HTML, images, video, sound etc. SOAP uses XML style encoding for messages which are sent over HTTP/FTP/SMTP.