SOAP vs REST | Difference between SOAP and REST Protocols
This page compares SOAP vs REST and mentions difference between SOAP and REST protocols. Let us understand basics of SOAP and REST protocols.
SOAP Protocol
• 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.
REST Protocol
The figure-2 depicts REST protocol stack. REST is the short form of Representational State Transfer. As shown it is built on HTTP/TCP layers. The REST protocol uses bus based architecture, where in no broker component is needed and end devices can communicate directly. In this request and response messages are used between end devices to exchange the information.
Difference between SOAP and REST
Following table mentions difference between SOAP and REST protocols.
SOAP | REST |
---|---|
Full form is Simple Object Access Protocol | Full form is Representational State Transfer |
It is a Standard protocol with predefined rules to follow. | It is architectural style with loose recommendation and guidelines. |
It is function driven i.e. transfer structured information. | It is data driven i.e. access a resource for data. |
It uses XML data format. | It allows use of many data formats viz. plain text, HTML, XML and JSON. |
It can be transported using any of the transfer protocols such as SMTP, HTTP, UDP and others. | It can be transported using HTTP only. |
It supports WS-security and SSL. | It supports SSL and HTTPS. |
It requires more resources and Bandwidth and it is heavy weight. | It requires fewer resources and it is light weight. |
Data can not be cached. | Data can be cached. |
It has strict communication contract and needs knowledge of everything before any interaction. | Needs no knowledge of API. |
It has built-in ACID compliance to reduce anomalies. | It lacks ACID compliance. |
Applications: Financial services, enterprise level apps, payment gateways, high security apps, telecommunication services. | Public APIs for web services, social networks and mobile services. |
Advantages: Standardization, security, extensibility. | High performance, scalability, flexibility, browser friendliness. |
Disadvantages: More complex, poor performance, less flexibility. | Unsuitable for distributed environments, less security. |
Conclusion: From above comparison between SOAP vs REST, we can conclude that SOAP is protocol and REST is architectural style. REST API utilizes SOAP protocol similar to its use of HTTP protocol.
IoT Wireless Technologies
➤WLAN
➤THREAD
➤EnOcean
➤LoRa
➤SIGFOX
➤WHDI
➤Zigbee
➤6LoWPAN
➤Zigbee RF4CE
➤Z-Wave
➤NFC
➤RFID
➤INSTEON
What is difference between
MQTT vs DDS MQTT vs HTTP MQTT vs REST MQTT vs SMQTT HTTP vs HTTPS OSI vs TCPIP TCP vs UDP FTP vs HTTP FTP vs SMTP FTP vs TFTP ARP vs RARP NAT vs PAT RIP vs OSPF SLIP vs PPP IMAP4 vs POP3 IPV4 vs IPV6