Network Protocol SOAP
If you want to communicate with other people in networks such as the Internet, you can only do it by following defined rules. In order to avoid the various computers and other network-enabled devices descending into chaos, they must comply with a network protocol. SOAP is — alongside REST — one of the most important protocols on the Internet.
What is SOAP?
Communication on the Internet is principally based on protocols such as HTTP, HTTPS, FTP or TCP. SOAP is one of them, essential for web services which command search engines, online shopping and many other services on the Internet. SOAP is one of the protocols that make this work. It is an interface that a device can use to make use of a server’s services.
Originally, the name SOAP was used as an acronym for "Simple Object Access Protocol". However, since this name doesn’t really fit the protocol (it's neither simple, nor does it only access objects), SOAP is now only used as a name.
SOAP has been in use since the 1990s to enable communication between a client – for example, the Internet browser – and a server’s services. For this to work, the client must make requests to the API. The SOAP framework governs how these requests should appear. However — and this is a great advantage of SOAP — application-specific data can be accommodated within this set of rules. This way, web services can provide diverse applications. SOAP only sets the basic rules so that they don’t all have to have the same syntax to be used as a web service.
The software developer Dave Wiener created SOAP in collaboration with a Microsoft team in order to create a working protocol for the Internet. Great emphasis was placed on making SOAP compatible with W3C standards. This made SOAP itself a W3C recommendation.
SOAP web services - the application areas of the protocol
SOAP then plays a role when a system needs to access another system in an orderly and limited way. Instead of just giving the requesting client complete access to the server, access can be restricted to the necessary functions using a protocol such as SOAP. With its architecture, SOAP also offers the advantage that very different systems are able to cooperate with each other: The protocol provides a framework into which the specific application can integrate.
Various web services are based on SOAP. For example, Amazon and eBay (partially) work with the network protocol.
The SOAP structure: How the protocol works
SOAP is based on the XML Information Set. Also a W3C recommendation, this collection of information units is necessary for an XML document that corresponds with a recommended structure. SOAP uses this in its message structure and therefore corresponds, in principle, to an XML document.
In most cases, SOAP will also be integrated in HTTP. The transport therefore functions using the known protocol and is integrated into its structure. In practice, an HTTP message with a SOAP request looks like this:
POST /example HTTP/1.1
Host: example.org
Content-Type: text/xml; charset=utf-8
…
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
...
<SOAP-ENV:Header>
...
</SOAP-ENV:Header>
<SOAP-ENV:Body>
...
</SOAP-ENV:Body>
</SOAP_ENV:Envelope>
In this example, the request starts with an HTTP header. Then the so-called SOAP envelope follows. As its name suggests, this wraps up the actual content of the message. Basic elements of SOAP are then the header and body.
- Header: The header of the SOAP request contains metadata, for example, on the encryption used. Its use is optional.
- Body: The body of the message contains the actual data.
The terms used in the body ultimately have nothing to do with SOAP itself, but are entirely application-dependent.
The protocol is often combined with the Web Services Description Language (WSDL). This is a description language specifically for web services, which, in turn, is platform-independent. A client can use speech to recognise which services a web service offers. The client determines from the WSDL file which options it has for a SOAP request. Therefore, WSDL and SOAP together allow two different systems to communicate with each other without any previous adjustments.
SOAP vs. REST
SOAP and REST (the latter is actually an architecture and not a protocol) are both used for web services, but both approach the task differently. While SOAP is a bit older, REST (or RESTful web services) has caught up a lot and currently provides approximately 70 percent of the web services available on the Internet.
Both, however, have different advantages. For example, REST is considered relatively simple, doesn’t just work with XML, is faster, and is lightweight compared to SOAP. While REST allows a lot of freedom with regard to XML (JSON is often used) SOAP gives users a choice of protocols. Although HTTP is the most common choice, in theory SOAP works well in combination with other protocols including FTP and SMTP.
SOAP also has a big security advantage: WS-Security (specifications on security aspects relating to web services) is firmly anchored in the network protocol. The handling of errors is also better regulated in SOAP, as a function for request repetition is directly integrated here.
Both SOAP and REST have advantages and disadvantages—you can’t really say that one solution is better than the other. For simplicity, however, most developers resort to REST. Ultimately, the choice depends on which programming language you use and in which context you want to use the protocol.