Simple Object Access Protocol (SOAP)

SOAP (Simple Object Access Protocol)is a protocol specification for exchanging structured information in the implementation of web services in computer networks. It relies on XML as its message format and uses other application layer protocols, most notably HTTP and SMTP, as the transport protocols. SOAP can form the foundation layer of a web services protocol stack, providing a basic messaging framework for web services.

Simple Object Access Protocol (SOAP)



source: Microsoft

History of SOAP

Early Development and Version 1.0 Late 1990s: The origins of SOAP date back to the late 1990s. It started as an initiative by Microsoft, IBM, and other companies to standardize the way in which computers could use the internet to communicate with each other. It was initially designed as an object-access protocol and was developed as a successor to earlier technologies such as the Distributed Component Object Model (DCOM) and Common Object Request Broker Architecture (CORBA).

1998: Dave Winer, Don Box, Bob Atkinson, and Mohsen Al-Ghosein, who were working at Microsoft, along with various other contributors, played a key role in the initial development of SOAP. Their work was based on the XML-RPC protocol, which was itself built upon a foundation laid by earlier remote procedure call (RPC) protocols.

Version 1.1 and W3C Involvement May 2000: SOAP 1.1 was submitted to the World Wide Web Consortium (W3C) by Microsoft, IBM, and Ariba. W3C is an international community that develops open standards to ensure the long-term growth of the Web. SOAP 1.1 was built on XML and HTTP, which allowed for a simple way to invoke methods and access servers, services, and objects across the internet.

2000-2003: During this period, SOAP became increasingly popular as a way of communicating between applications without requiring any additional technologies or components. Various organizations started to see the value of using SOAP as a way to expose web services, and the protocol began to be widely adopted as a standard for web services communication.

Version 1.2 and Standardization June 24, 2003: SOAP 1.2 became a W3C recommendation. Unlike SOAP 1.1, which was focused on the remote procedure call (RPC) pattern, SOAP 1.2 provided the flexibility to apply it to a variety of messaging patterns. With this version, the W3C introduced the concept of a “message construct” that did not rely on RPC and could be used with various transport protocols, not just HTTP. This helped broaden the appeal and application of SOAP.

2007: The Web Services Reliable Messaging (WS-ReliableMessaging) and Web Services Security (WS-Security) specifications were developed. These extensions built upon SOAP to add new features and capabilities, particularly in terms of security, reliability, and transactions. These specifications helped to establish SOAP as a robust and secure protocol for enterprise-level web services.

Further Adoption and Use Cases Mid-2000s to Present: SOAP has been a fundamental protocol for enabling web services in enterprise environments due to its robustness, security, and standardization. Industries like finance, healthcare, and telecommunications, which require secure and ACID-compliant transactions, have been significant adopters of SOAP-based web services.

SOAP vs. REST: As the technology world evolved, especially with the advent of mobile and cloud computing, there was a growing trend towards using simpler, more lightweight protocols. This has led to the widespread adoption of Representational State Transfer (REST) as an alternative to SOAP for certain types of services, particularly those that are public-facing and do not require extensive security features. Nonetheless, SOAP remains heavily used for service interfaces that require complex operations and strong security, such as in enterprise-level applications and services.

Legacy and Ongoing Use Today: SOAP is still widely used in various industries, especially in scenarios where there is a need for high security, reliability, and ACID-compliant transactions. It is a key component in various WS-* standards for web services and continues to be used in conjunction with a multitude of other protocols and technologies.

Characteristics of Simple Object Access Protocol (SOAP)

These characteristics have made SOAP a prevalent protocol in enterprise environments where robustness, security, and reliability are critical, particularly in scenarios like financial transactions, healthcare data exchanges, and telecommunications. Nonetheless, the verbose and heavy nature of SOAP messages has also led to the rise of alternative, more lightweight protocols, particularly for public APIs and mobile or web applications.

Components and Structure of SOAP

The Simple Object Access Protocol (SOAP) is a protocol specification for exchanging structured information in the implementation of web services in computer networks. SOAP messages are XML-based and have a standard structure that consists of specific components. Below is a detailed description of these components and the overall structure of a SOAP message:

Envelope
The Envelope is the topmost element in a SOAP message. It defines the start and end of a message, making it clear what portions of the XML document are considered to be part of the SOAP message. It is a mandatory part of any SOAP message. The Envelope element encloses all other elements of the SOAP message.


Envelope


Header
The Header is an optional element used to contain application-specific information (like authentication, payment, etc.) or attributes of the message (like which web service action is being invoked). The Header element is used to add additional features and functionalities in the SOAP message. If specified, the Header is the first child element after the opening Envelope tag.


Header


SOAP headers can be marked as mandatory. If a SOAP processor receives a header that is marked as mandatory but doesn't understand how to process it, the message is rejected.

Body
The Body is a mandatory element and is used to contain the actual SOAP message intended for the ultimate endpoint of the message. It is the second child element after the opening Envelope tag. This is where the service request or response gets detailed.


Body.png


The Body element contains child elements, each representing a separate remote procedure call or a message. These elements are sometimes called SOAP body entries, and each one can encode the input or output parameters of a call.

Fault
The Fault element is an optional sub-element of the Body element. It is used to hold errors and status information for SOAP messages. If a Fault element is present, it must appear as a child of the Body element. This element is used to indicate error messages.


Fault element.png


faultcode: A code that categorizes the error. Standard fault codes are defined by the SOAP specification. faultstring: A human-readable description of the fault. faultactor: (Optional) Information about who caused the fault to happen within the message path. detail: (Optional) Specific application-level error information related to the Body element. It is used to provide more detailed error information.

Attachments (SOAP with Attachments)
Though not a part of the core SOAP specification, SOAP messages can be used in combination with attachments. SOAP with Attachments is a specific way to associate documents of any type with a SOAP message. The attachments are not part of the actual SOAP message but are part of the extended SOAP message package, which includes the SOAP envelope and its associated attachments. Examples of this usage include sending an image, audio, or complex business data in formats like PDF or Word.

Example of a Complete SOAP Message:
Here is an example of what a complete SOAP message might look like:


Example of Complete Soap Message.png


In this example:

The Envelope is identified by the soap: Envelope tag. The Header contains transaction details with the value "234". The Body contains a GetPrice request for stock with the symbol "GOOG". This structure of a SOAP message allows for highly extensible and structured communications that can be used across different platforms and programming languages, which has made SOAP a fundamental protocol for enabling web services, especially in enterprise-level applications.

Use Cases for Simple Object Access Protocol (SOAP)

These use cases illustrate the versatility and robustness of SOAP as a protocol for web services, especially in environments where security, reliability, and complex transactions are a priority. However, it is worth considering the trade-offs, as SOAP can be more heavyweight and complex than other web service approaches, such as REST or GraphQL. The choice of SOAP or another protocol will depend on the specific requirements of the project or system in question.

Advantages of Simple Object Access Protocol (SOAP)

Disadvantages of Simple Object Access Protocol (SOAP)

These disadvantages don't necessarily make SOAP a poor choice, but they do illustrate where SOAP might not be the best fit. It is still heavily used in many enterprise environments and industries, such as healthcare and finance, where its advantages in terms of security, transactions, and standardization are highly valued. The choice between SOAP and other web service protocols typically depends on the specific needs of the application and the environment in which it operates.