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 Information Set for its message format, and usually relies on other Application Layer protocols, most notably Hypertext Transfer Protocol (HTTP) or Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.
SOAP can form the foundation layer of a web services protocol stack, providing a basic messaging framework upon which web services can be built. This XML-based protocol consists of three parts: an envelope, which defines what is in the message and how to process it, a set of encoding rules for expressing instances of application-defined datatypes, and a convention for representing procedure calls and responses. SOAP has three major characteristics: extensibility (security and WS-routing are among the extensions under development), neutrality (SOAP can be used over any transport protocol such as HTTP, SMTP, TCP, or JMS), and independence (SOAP allows for any programming model).
The SOAP architecture consists of several layers of specifications for: message format, Message Exchange Patterns (MEP), underlying transport protocol bindings, message processing models, and protocol extensibility. SOAP is the successor of XML-RPC, though it borrows its transport and interaction neutrality and the envelope/header/body from elsewhere (probably from WDDX).
SOAP Messaging Framework
The SOAP specification defines the messaging framework which consists of:
• The SOAP processing model defining the rules for processing a SOAP message
• The SOAP extensibility model defining the concepts of SOAP features and SOAP modules
• The SOAP underlying protocol binding framework describing the rules for defining a binding to an underlying protocol that can be used for exchanging SOAP messages between SOAP nodes
• The SOAP message construct defining the structure of a SOAP message
Both SMTP and HTTP are valid application layer protocols used as transport for SOAP, but HTTP has gained wider acceptance as it works well with today's internet infrastructure; specifically, HTTP works well with network firewalls. SOAP may also be used over HTTPS (which is the same protocol as HTTP at the application level, but uses an encrypted transport protocol underneath) with either simple or mutual authentication; this is the advocated WS-I method to provide web service security as stated in the WS-I Basic Profile 1.1.
Why SOAP Is Used?
SOAP is used when systems need:
• Strong security requirements
• Formal communication contracts
• Reliable and structured messaging
• Enterprise-grade interoperability
Typical use cases:
• Banking systems
• Payment gateways
• Telecom systems
• Government services
Key Features of SOAP
1. XML-Based Messaging
All data is formatted in XML, making it highly structured but verbose.
2. Strict Contract (WSDL)
Services are defined using WSDL (Web Services Description Language):
• Describes operations
• Defines request/response formats
3. Transport Independent
SOAP can work over:
• HTTP/HTTPS (most common)
• SMTP
• TCP, etc.
4. Built-in Error Handling
Uses SOAP Faults to report errors in a structured way.
5. Extensibility
Supports additional standards like:
• WS-Security (encryption, authentication)
• WS-ReliableMessaging
Advantages
• Very secure and reliable
• Strong formal contract (WSDL)
• Platform and language independent
• Good for enterprise integration
• Built-in error handling
Disadvantages
• Heavy and verbose (XML overhead)
• Slower compared to REST
• Complex to implement and debug
• Not ideal for lightweight or mobile applications