Simple Object Access Protocol is a messaging protocol that is mainly used to communicate between different application elements. SOAP is very popular in enterprise applications for messaging and data transmission.
- SOAP is not an old protocol that is first created in 1998. This version was named as
XML-RPCwhere the XML messages and data are transmitted over remote procedure calls via HTTP protocol.
- The second SOAP version release was 1.1 which is released in May 2000.
- The more popular used version SOAP 1.2 is released in June 2003 and became a W3C recommendation.
SOAP became popular because of the features it provided. Here are some of the features which makes SOAP.
- SOAP is designed to be used to communicate via the internet.
- SOAP uses HTTP for transmission of the XML messages.
- SOAP provides data transport and transmission features for the Web Services.
- SOAP can exchange different data and document types.
- SOAP can broadcast messages into different nodes or hosts.
- SOAP provides a platform or language-independent usage.
- SOAP enables clients to connect remote services and servers.
- SOAP is a format for sending and receiving messages and call remote procedures.
- SOAP is based on XML language which is structured and readable.
Before starting to explain the SOAP protocol in details we need to learn some basic SOAP terminology to define SOAP protocol.
SOAP Nodeis a physical or logical system that can process SOAP messages by receiving or sending.
SOAP Rolesis used to set specific roles and duties to the specified SOAP Nodes like only read or no process etc.
SOAP Protocol Bindingis connecting the SOAP Node to the remote SOAP Nodes by using TCP and HTTP protocols.
SOAP Moduleis extension of the existing SOAP semantics.
SOAP Messagerepresents information exchanged between SOAP Nodes.
SOAP Envolopeis the enclosing element of an XML message identifying as a SOAP message.
SOAP Bodycontains the body of the messaged for the SOAP receiver.
SOAP Headercontains the collection of one or more header blocks target at each SOAP Receiver.
SOAP Senderis the SOAP Node sending the message.
SOAP Receiveris the SOAP Node receiving the message.
SOAP Message Pathis the SOAP Nodes which will process the SOAP message in given precedence and queue.
SOAP Building Blocks
As a standard SOAP provides some rules and building blocks to make SOAP popular and reliable protocol. Let’s take the following simple SOAP message which has a very basic structure.
<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Header> ... </soap:Header> <soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope>
We can see that its a SOAP Envelope which contains Header, Body and Fault parts.
SOAP protocol provides some advantages which make is a popular protocol.
- SOAP can be transmitted to reliable well-known protocol HTTP.
- SOAP messages can be also transmitted through different methods and protocols like SMTP, JMS or message queues.
- SOAP can be transmitted through different network and security devices like Firewall, IPS/IDS without any restriction.
- SOAP is extensible to meet different requirements.
Event SOAP provides a lot of advantages it also poses some disadvantages.
- SOAP is heavyweight protocol where it needs a lot of processing.
- SOAP is complex which is some time makes things slow.
- Reading a SOAP is more difficult then alternatives like REST or JSON etc.