Simple Object Access Protocol(SOAP)
1. Introduction
SOAP is a protocol for exchanging structured information between distributed software systems.
Unlike REST, which is an architectural style, SOAP is an actual messaging protocol with a formally defined message structure, processing model, extensibility mechanism, and protocol-binding framework.
SOAP is strongly associated with:
- XML
- WSDL
- HTTP
- RPC-style service invocation
- enterprise web services
- strongly typed contracts
- XML Schema
- SOAP Headers
- SOAP Faults
- WS-Security
- WS-Addressing
- WS-ReliableMessaging
- WS-Policy
- MTOM
- other WS-* specifications
A useful first approximation is:
SOAP
= structured message protocol
+ XML-based message format
+ processing model
+ extensibility mechanism
+ protocol binding modelHowever, SOAP itself does not define everything normally associated with an enterprise web service.
For example:
SOAP
does not inherently define:
authentication
authorization
encryption
reliable delivery
transactions
service discovery
routing
business semantics
Those capabilities can be added through
separate specifications and SOAP modules/extensions.This separation is one of the most important characteristics of SOAP.
2. SOAP in the Protocol Stack
A common misconception is that SOAP and HTTP are competing protocols.
They are not.
A typical SOAP-over-HTTP deployment looks approximately like:
+--------------------------------------------------+
| Application semantics |
| |
| "CreateCustomer", "GetAccount", etc. |
+--------------------------------------------------+
| SOAP message |
| |
| Envelope |
| Header |
| Body |
| Fault |
+--------------------------------------------------+
| HTTP |
| |
| POST /CustomerService HTTP/1.1 |
| Content-Type: application/soap+xml |
| Content-Length: ... |
+--------------------------------------------------+
| TCP |
+--------------------------------------------------+
| IP |
+--------------------------------------------------+
| Ethernet / Wi-Fi / etc. |
+--------------------------------------------------+The important distinction is:
HTTP = transport/application protocol carrying the message
SOAP = message protocol carried by that transportSOAP 1.2 was specifically designed around a protocol-binding framework, allowing SOAP messages to be exchanged using different underlying protocols. HTTP is simply the most historically common binding.
Therefore:
SOAP over HTTP
SOAP over SMTP
SOAP over other transportsare conceptually possible.
The SOAP message itself does not fundamentally depend on HTTP.
3. Is SOAP an OSI Layer 7 Protocol?
This requires more careful terminology than simply saying:
SOAP is Layer 7.
SOAP is an application-layer protocol.
Therefore it can reasonably be discussed at the OSI Layer 7 level.
A simplified stack is:
OSI Layer 7
SOAP
HTTP
DNS
SMTP
etc.
OSI Layer 4
TCP
UDP
QUIC
OSI Layer 3
IP
OSI Layer 2
Ethernet / Wi-FiBut the OSI model is conceptual, and modern Internet protocols do not always map cleanly onto individual OSI layers.
More importantly:
REST ≠ protocol
SOAP = protocol
HTTP = protocolREST is an architectural style.
SOAP is a defined messaging protocol.
HTTP is a defined application protocol.
4. Historical Background
SOAP emerged during the late 1990s as an attempt to standardize structured communication between distributed applications.
SOAP 1.1 was published in 2000.
The original SOAP 1.1 specification described SOAP as an XML-based mechanism for exchanging structured and typed information and included:
- an envelope
- encoding rules
- RPC conventions
- HTTP bindings
SOAP 1.2 subsequently became a W3C Recommendation in 2007.
SOAP 1.2 significantly clarified and formalized the architecture around:
- message processing
- extensibility
- protocol bindings
- message constructs
- message exchange patterns
SOAP 1.2 also explicitly stopped treating "SOAP" as an acronym.
Therefore:
SOAP 1.1:
Simple Object Access Protocol
SOAP 1.2:
SOAP is simply the name of the protocolSOAP 1.1 remains extremely important historically because many enterprise systems and libraries still use it.
5. SOAP 1.1 vs SOAP 1.2
The two versions are similar conceptually but differ in several important protocol details.
| Feature | SOAP 1.1 | SOAP 1.2 |
|---|---|---|
| Status | W3C Note | W3C Recommendation |
| Namespace | http://schemas.xmlsoap.org/soap/envelope/ | http://www.w3.org/2003/05/soap-envelope |
| HTTP Content-Type | commonly text/xml | application/soap+xml |
| Action indication | SOAPAction HTTP header | action parameter of Content-Type |
| Fault model | older fault vocabulary | redesigned fault model |
| Processing model | less formally separated | explicitly defined |
| Protocol bindings | more HTTP-oriented | generalized binding framework |
| Encoding | SOAP encoding commonly associated | encoding separated from core framework |
For interoperability work, SOAP version matters.
A SOAP 1.1 endpoint and SOAP 1.2 endpoint are not simply interchangeable because the envelope namespace and HTTP binding semantics differ.
6. The SOAP Message
At the core of SOAP is the SOAP message.
A SOAP 1.2 message is an XML document whose root element is:
<env:Envelope>A simplified structure is:
<env:Envelope>
<env:Header>
...
</env:Header>
<env:Body>
...
</env:Body>
</env:Envelope>The fundamental structure is:
Envelope
├── Header optional
└── Body requiredThe Header can contain zero or more header blocks.
The Body contains information intended for the ultimate receiver.
A Fault is represented inside the Body.
7. SOAP 1.2 Envelope
A typical SOAP 1.2 request might look like:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:m="http://example.com/customer">
<soap:Header>
...
</soap:Header>
<soap:Body>
<m:GetCustomer>
<m:customerId>12345</m:customerId>
</m:GetCustomer>
</soap:Body>
</soap:Envelope>The namespace prefix soap has no special meaning.
This:
<soap:Envelope>and this:
<s:Envelope>are equivalent if the prefixes resolve to the same namespace URI.
For example:
xmlns:s="http://www.w3.org/2003/05/soap-envelope"is perfectly valid.
The namespace URI, not the prefix, identifies the SOAP vocabulary.
8. SOAP Envelope Rules
The Envelope:
- must exist
- must be the root XML element
- identifies the SOAP version through its namespace
- contains the optional Header
- contains the mandatory Body
Conceptually:
XML Document
|
v
SOAP Envelope
|
+------ Header (optional)
|
+------ Body (required)The Body follows the Header if a Header exists.
9. SOAP Header
The SOAP Header is one of SOAP's most important architectural features.
It provides a standardized location for message-level extensions.
Example:
<soap:Header>
<auth:Authentication
xmlns:auth="http://example.com/auth">
<auth:Username>alice</auth:Username>
<auth:Token>...</auth:Token>
</auth:Authentication>
</soap:Header>The application payload remains in the Body.
This creates a separation:
Header
protocol/service metadata
Body
application messageExamples of information that may appear in SOAP headers include:
- security credentials
- digital signatures
- encryption metadata
- message IDs
- correlation IDs
- routing information
- transaction information
- reliability information
- policy-related metadata
This extensibility model is fundamental to the later WS-* ecosystem.
10. Header Blocks
A SOAP Header can contain multiple independent blocks.
Conceptually:
<soap:Header>
<A>...</A>
<B>...</B>
<C>...</C>
</soap:Header>Each header block can have its own semantics.
This makes SOAP capable of supporting intermediary processing.
For example:
Client
|
| SOAP message
v
Security Gateway
|
| process security header
v
Message Router
|
| process routing header
v
Application Server
|
| process application body
v
ServiceThe SOAP processing model therefore isn't simply:
sender -> final applicationIt can be:
sender
|
v
intermediary
|
v
intermediary
|
v
ultimate receiver11. mustUnderstand
One of SOAP's important header-processing mechanisms is:
soap:mustUnderstandThe idea is:
If a receiver cannot understand a mandatory header block, it must not silently ignore it.
For example:
<sec:Security
soap:mustUnderstand="true">
...
</sec:Security>The exact lexical representation depends on the SOAP version and schema.
The semantic purpose is more important:
Header says:
"You MUST understand/process this."
Receiver says:
"I don't understand it."
Result:
SOAP processing fault.This prevents silent interoperability failures.
Without such a mechanism, a sender could believe:
"Security policy was applied."while the receiver actually did:
"Security header ignored."That would be dangerous.
12. SOAP Intermediaries
SOAP explicitly supports message paths containing intermediaries.
Consider:
Client
|
v
+----------------+
| Security Node |
+----------------+
|
v
+----------------+
| Router |
+----------------+
|
v
+----------------+
| Service |
+----------------+Different SOAP header blocks can be intended for different nodes.
Therefore SOAP can carry both:
end-to-end informationand
hop-specific informationThis is one reason SOAP's message model is more sophisticated than simply:
HTTP POST + XML13. SOAP Body
The SOAP Body contains the main message payload.
Example:
<soap:Body>
<m:GetCustomer>
<m:customerId>12345</m:customerId>
</m:GetCustomer>
</soap:Body>The Body can represent:
- an RPC invocation
- a document
- application data
- a response
- a fault
SOAP itself does not require every Body to represent a method invocation.
This distinction is important.
14. RPC Style
Historically, SOAP was heavily associated with RPC.
For example:
GetCustomer(12345)can conceptually become:
<soap:Body>
<m:GetCustomer>
<m:customerId>12345</m:customerId>
</m:GetCustomer>
</soap:Body>The response might be:
<soap:Body>
<m:GetCustomerResponse>
<m:customer>
<m:id>12345</m:id>
<m:name>Alice</m:name>
</m:customer>
</m:GetCustomerResponse>
</soap:Body>This looks similar to calling a local function.
However:
SOAP ≠ RPCSOAP can also be used for document-oriented messaging.
15. Document Style
A document-oriented SOAP message treats the Body as a business document rather than an RPC invocation.
For example:
<soap:Body>
<PurchaseOrder
xmlns="http://example.com/purchase">
<OrderId>PO-1001</OrderId>
<Customer>
<Id>123</Id>
</Customer>
<Items>
...
</Items>
</PurchaseOrder>
</soap:Body>The distinction is:
RPC style
invoke operation
|
+-- parameters
Document style
exchange business document
|
+-- document schemaEnterprise SOAP systems frequently use document-oriented contracts.
16. Literal vs Encoded SOAP
SOAP historically defined encoding rules.
The important distinction is:
encodedversus
literalSOAP Encoding
SOAP encoding attempts to describe how application data structures are represented in XML.
It historically supported concepts such as:
- arrays
- compound values
- references
- polymorphic values
- typed values
Literal
Literal means the XML representation follows an XML Schema-defined representation rather than SOAP's own encoding rules.
In modern interoperable enterprise SOAP systems, you will commonly encounter:
document/literalespecially:
document/literal wrappedThis is important when working with WSDL and interoperability profiles.
17. SOAP over HTTP
SOAP is frequently transported over HTTP.
A SOAP 1.1 request might look approximately like:
POST /CustomerService HTTP/1.1
Host: api.example.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "GetCustomer"
Content-Length: 512
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://example.com/customer">
<soap:Body>
<m:GetCustomer>
<m:customerId>12345</m:customerId>
</m:GetCustomer>
</soap:Body>
</soap:Envelope>The HTTP layer sees:
POST
URI
HTTP headers
HTTP bodyThe SOAP layer sees:
Envelope
Header
Body
application messageThese are different protocol layers.
18. SOAP 1.1 SOAPAction
SOAP 1.1 commonly uses:
SOAPAction: "GetCustomer"This HTTP header is associated with the intended SOAP action.
For example:
POST /CustomerService HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://example.com/GetCustomer"This led to a common implementation pattern:
HTTP request
|
+-- URI
|
+-- SOAPAction
|
+-- SOAP XML bodyThe HTTP server/framework can use SOAPAction to select the operation.
19. SOAP 1.2 Action
SOAP 1.2 changes the mechanism.
A SOAP 1.2 request commonly uses:
Content-Type: application/soap+xml;
charset=utf-8;
action="http://example.com/GetCustomer"Therefore:
SOAP 1.1
SOAPAction:
HTTP header
SOAP 1.2
action:
parameter associated with application/soap+xmlThis is an important practical interoperability distinction.
20. HTTP Status Codes vs SOAP Faults
SOAP introduces another layer of error semantics.
Suppose a SOAP service encounters:
Customer does not exist.That may be represented as a SOAP Fault.
HTTP also has status codes:
HTTP/1.1 500 Internal Server ErrorTherefore there can be two semantic layers:
HTTP
transport/protocol outcome
SOAP
message/application processing outcomeDo not automatically equate:
HTTP 500with:
business failureor assume every SOAP error is represented only by HTTP status.
SOAP's own fault model must be considered.
21. SOAP Fault
A SOAP Fault is a standardized representation of a SOAP processing failure.
SOAP 1.2 has a structured fault model.
Conceptually:
<soap:Body>
<soap:Fault>
<soap:Code>
...
</soap:Code>
<soap:Reason>
...
</soap:Reason>
<soap:Node>
...
</soap:Node>
<soap:Role>
...
</soap:Role>
<soap:Detail>
...
</soap:Detail>
</soap:Fault>
</soap:Body>The exact elements and semantics matter.
22. SOAP 1.2 Fault Structure
The major SOAP 1.2 Fault components are:
Fault
├── Code
│ └── Value
│ └── optional Subcode
│
├── Reason
│
├── Node
│
├── Role
│
└── DetailCode
Identifies the class of failure.
Examples include:
VersionMismatch
MustUnderstand
DataEncodingUnknown
Sender
ReceiverReason
Human-readable explanation.
Node
Identifies the SOAP node that generated the fault.
Role
Identifies the role being played by that node.
Detail
Application-specific fault information.
23. Example SOAP 1.2 Fault
<soap:Fault>
<soap:Code>
<soap:Value>
soap:Sender
</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">
Customer ID is invalid.
</soap:Text>
</soap:Reason>
<soap:Detail>
<m:InvalidCustomerId
xmlns:m="http://example.com/customer">
<m:id>-1</m:id>
<m:message>Customer ID must be positive.</m:message>
</m:InvalidCustomerId>
</soap:Detail>
</soap:Fault>The important architectural distinction is:
SOAP fault structure
+
application-specific DetailThe SOAP layer provides the common fault envelope while the application can define domain-specific error information.
24. SOAP Message Exchange Patterns
SOAP messages are fundamentally one-way transmissions:
Sender
|
| SOAP message
v
ReceiverA request/response interaction is constructed from multiple message transmissions:
Client
|
| Request
v
Server
|
| Response
v
ClientSOAP 1.2 defines the concept of Message Exchange Patterns (MEPs).
Examples include:
Request-Response
One-WayExtensions can define additional patterns.
This is an important conceptual distinction:
SOAP messageis not inherently synonymous with:
HTTP requestor:
RPC call25. SOAP Protocol Binding
SOAP separates:
SOAP message modelfrom:
underlying transportThe binding defines how SOAP interacts with another protocol.
Conceptually:
SOAP
|
+-------+-------+
| | |
HTTP SMTP ...A binding specifies how SOAP concepts map onto the underlying protocol.
For example:
SOAP Message
|
v
HTTP Binding
|
v
HTTP Request / ResponseThis architectural separation is one of the major improvements in SOAP 1.2.
26. SOAP and XML
SOAP uses XML technologies.
A SOAP message therefore has several nested levels:
Bytes
|
v
XML serialization
|
v
SOAP XML document
|
v
Envelope
|
+-- Header
|
+-- Body
|
+-- application XMLThe application payload itself may use XML Schema-defined types.
For example:
<customer>
<id>123</id>
<name>Alice</name>
</customer>can be constrained using XML Schema.
27. XML Schema
SOAP systems frequently rely heavily on:
XML Schema (XSD).
XSD can define:
elements
attributes
simple types
complex types
enumerations
restrictions
extensions
cardinality
required/optional fieldsFor example:
<xs:complexType name="Customer">
<xs:sequence>
<xs:element
name="id"
type="xs:int"/>
<xs:element
name="name"
type="xs:string"/>
</xs:sequence>
</xs:complexType>This provides strong structural typing.
28. Why XML Schema Matters to SOAP
Consider a service operation:
CreateCustomer(Customer)Without a formal contract, the client needs to know:
What fields?
What types?
Which fields are mandatory?
What order?
What response?
What faults?
What endpoint?
What binding?A SOAP ecosystem can formalize these through:
XSD
+
WSDL
+
SOAP
+
WS-* specificationsThis leads directly to WSDL.
29. WSDL
WSDL = Web Services Description Language
WSDL describes a web service contract.
It answers questions such as:
What operations exist?
What messages are exchanged?
What XML types are used?
What protocol binding is used?
Where is the service available?The important conceptual distinction is:
SOAP
defines how SOAP messages work
WSDL
describes a service contractSOAP does not require WSDL.
Similarly:
WSDL does not itself equal SOAP.WSDL can describe services using different bindings.
30. WSDL as a Contract
A useful conceptual model is:
WSDL
|
+-------------+-------------+
| | |
Types Operations Binding
| | |
+-------------+-------------+
|
EndpointThe client can use the WSDL to determine how to communicate with the service.
This is why SOAP systems are often called:
contract-firstsystems.
31. WSDL 1.1 Structure
WSDL 1.1 commonly uses the following major constructs:
definitions
│
├── types
│
├── message
│
├── portType
│
├── binding
│
└── service
└── portThese are worth understanding individually.
32. WSDL types
The types section contains data type definitions.
Typically:
<wsdl:types>
<xsd:schema
targetNamespace="http://example.com/customer">
...
</xsd:schema>
</wsdl:types>The types are usually expressed using XML Schema.
Conceptually:
WSDL
|
+-- types
|
+-- XSD
|
+-- Customer
+-- Address
+-- Order33. WSDL message
A WSDL 1.1 message describes a logical message.
For example:
<wsdl:message name="GetCustomerRequest">
<wsdl:part
name="parameters"
element="tns:GetCustomer"/>
</wsdl:message>The response may be:
<wsdl:message name="GetCustomerResponse">
<wsdl:part
name="parameters"
element="tns:GetCustomerResponse"/>
</wsdl:message>Think of:
messageas describing the data exchanged for an operation.
34. WSDL portType
The WSDL 1.1 portType represents the abstract interface.
Example:
<wsdl:portType name="CustomerPortType">
<wsdl:operation name="GetCustomer">
<wsdl:input
message="tns:GetCustomerRequest"/>
<wsdl:output
message="tns:GetCustomerResponse"/>
</wsdl:operation>
</wsdl:portType>Conceptually:
portType
|
+-- operation
|
+-- input
|
+-- output
|
+-- faultThis is similar to an interface definition in programming.
35. WSDL binding
The abstract interface does not necessarily specify the concrete wire details.
The binding supplies those details.
For example:
<wsdl:binding
name="CustomerSoapBinding"
type="tns:CustomerPortType">
...
</wsdl:binding>The binding can describe:
SOAP version
style
encoding
operation mapping
transport
wire-level detailsConceptually:
Abstract interface
|
v
Binding
|
v
Concrete protocol representation36. WSDL service
A WSDL service associates a service with concrete endpoints.
Example:
<wsdl:service name="CustomerService">
<wsdl:port
name="CustomerPort"
binding="tns:CustomerSoapBinding">
<soap:address
location="https://api.example.com/customer"/>
</wsdl:port>
</wsdl:service>Conceptually:
Service
|
+-- Port
|
+-- Binding
|
+-- Address37. WSDL 1.1: Complete Conceptual Model
A useful way to remember WSDL 1.1 is:
types
What data exists?
message
What data crosses the boundary?
portType
What operations exist?
binding
How are those operations represented on the wire?
service
Where can I access them?
port
Which endpoint implements which binding?Therefore:
XSD
|
v
Types
|
v
Messages
|
v
PortType
|
v
Binding
|
v
Service / Port
|
v
Endpoint38. WSDL 2.0
WSDL 2.0 reorganized the conceptual model.
The major constructs are:
Description
│
├── Types
│
├── Interface
│
├── Binding
│
└── Service
└── EndpointThe important conceptual mapping is roughly:
WSDL 1.1 WSDL 2.0
portType -> interface
port -> endpoint
service -> service
binding -> bindingWSDL 2.0 explicitly separates abstract service functionality from concrete details such as binding and endpoint address.
39. WSDL 1.1 vs WSDL 2.0
| Concept | WSDL 1.1 | WSDL 2.0 |
|---|---|---|
| Abstract interface | portType | interface |
| Operation | operation | operation |
| Message | message | modeled through interface/message references |
| Concrete protocol | binding | binding |
| Endpoint | port | endpoint |
| Service | service | service |
| XML Schema | Common | Common |
| Industry prevalence | Very high | Lower historically |
In practical enterprise environments, WSDL 1.1 remains extremely important despite WSDL 2.0 being the newer W3C specification.
40. Example WSDL 1.1
A simplified WSDL might look like:
<?xml version="1.0"?>
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.com/customer"
targetNamespace="http://example.com/customer">
<wsdl:types>
<xsd:schema
targetNamespace="http://example.com/customer">
<xsd:element
name="GetCustomer">
...
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetCustomerRequest">
...
</wsdl:message>
<wsdl:message name="GetCustomerResponse">
...
</wsdl:message>
<wsdl:portType name="CustomerPortType">
<wsdl:operation name="GetCustomer">
<wsdl:input
message="tns:GetCustomerRequest"/>
<wsdl:output
message="tns:GetCustomerResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding
name="CustomerSoapBinding"
type="tns:CustomerPortType">
...
</wsdl:binding>
<wsdl:service name="CustomerService">
<wsdl:port
name="CustomerPort"
binding="tns:CustomerSoapBinding">
<soap:address
location="https://api.example.com/customer"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>The actual WSDL can be considerably more complicated because of imported schemas, policies, WS-Addressing, security requirements, multiple bindings, and faults.
41. Contract-First Development
A major SOAP development model is:
WSDL
|
v
Generate client/server artifacts
|
v
Implement business logicFor example:
customer.wsdl
|
v
WSDL compiler
|
+----> client proxy
|
+----> server skeleton
|
+----> XML types
|
+----> service interfacesThe generated proxy might allow code such as:
Customer customer =
customerClient.getCustomer(12345);while the framework handles:
Java object
|
v
XML serialization
|
v
SOAP Envelope
|
v
HTTPThis is one reason SOAP can appear to behave like local procedure calls.
42. Generated Client Proxies
A SOAP client often consists of:
Application
|
v
Generated Proxy
|
v
SOAP Runtime
|
v
HTTP Client
|
v
NetworkThe programmer may only see:
client.getCustomer(12345)while underneath:
object
-> XML
-> SOAP
-> HTTP
-> TCP
-> serverThe server reverses this:
HTTP
-> SOAP
-> XML parsing
-> deserialization
-> dispatch
-> service method43. SOAP Processing Model
A SOAP node processes a SOAP message.
Conceptually:
Receive bytes
|
v
Parse XML
|
v
Identify SOAP version
|
v
Process Envelope
|
v
Identify applicable headers
|
v
Process mandatory headers
|
v
Process Body
|
v
Invoke application processingAn intermediary may process only the headers intended for its role and forward the message.
44. SOAP Node Roles
SOAP defines concepts around message-processing nodes.
A simplified model:
Initial Sender
|
v
Intermediary
|
v
Ultimate ReceiverThe ultimate receiver is the final intended SOAP node.
Intermediaries can perform functions such as:
routing
security processing
logging
validation
reliability
transaction processingThese are generally implemented through SOAP modules/specifications rather than being hard-coded into the SOAP core.
45. SOAP Extensibility
One of SOAP's strongest characteristics is extensibility.
The core SOAP framework intentionally does not try to solve every distributed-systems problem.
Instead:
SOAP Core
|
+-- Security
|
+-- Addressing
|
+-- Reliability
|
+-- Transactions
|
+-- Policy
|
+-- Attachments
|
+-- Other featuresThis resulted in the large family commonly called:
WS-*46. The WS-* Ecosystem
"WS-*" is not one specification.
It is a family of related specifications.
Some historically important members include:
WS-Security
WS-Addressing
WS-ReliableMessaging
WS-Policy
WS-Coordination
WS-AtomicTransaction
WS-Trust
WS-SecureConversation
WS-NotificationNot every SOAP deployment uses all of these.
A better mental model is:
SOAP
|
+-- optional feature specifications
|
+-- security
+-- addressing
+-- reliability
+-- policy
+-- transactions
+-- etc.47. WS-Security
WS-Security provides SOAP-level mechanisms for message security.
It addresses concerns such as:
- message integrity
- message confidentiality
- security tokens
- signatures
- encryption
This is fundamentally different from simply using TLS.
48. TLS vs WS-Security
Suppose:
Client
|
| TLS
v
Gateway
|
| internal network
v
ServiceTLS protects the communication channel.
The gateway terminates TLS:
Client ==TLS==> Gateway
Gateway -------=> ServiceThe original end-to-end message may no longer have transport-level protection.
WS-Security can instead protect portions of the SOAP message itself.
Conceptually:
SOAP Envelope
|
+-- Security Header
| |
| +-- Signature
| +-- Encryption
| +-- Token
|
+-- BodyTherefore:
TLS
protects:
connection/channel
WS-Security
protects:
SOAP message/contentThe two can be used together.
49. Digital Signatures
A SOAP message can carry XML Signature information.
Conceptually:
SOAP Body
|
v
Canonicalization
|
v
Digest
|
v
Digital SignatureA receiver can verify:
Was the message modified?
Who signed it?
Which parts were signed?This is particularly useful in multi-hop systems.
50. Message-Level Encryption
WS-Security can also support XML encryption.
Conceptually:
SOAP Envelope
|
+-- Header
|
+-- Body
|
+-- encrypted contentThis can allow only selected portions of the message to be encrypted.
That is fundamentally different from transport encryption:
TLS:
encrypt network connection
Message-level encryption:
encrypt message content51. Security Tokens
WS-Security supports mechanisms for carrying security credentials.
Examples include:
UsernameToken
X.509 certificates
SAML assertions
Kerberos-related tokensThe exact mechanism depends on the profile and deployment.
This enables a message to carry security context along with the message itself.
52. WS-Addressing
HTTP already provides an address:
POST /CustomerService
Host: api.example.comBut distributed messaging can require more than a transport-level URI.
WS-Addressing introduces message-level addressing concepts.
For example:
<wsa:MessageID>
uuid:...
</wsa:MessageID>
<wsa:To>
https://api.example.com/customer
</wsa:To>
<wsa:Action>
http://example.com/GetCustomer
</wsa:Action>
<wsa:ReplyTo>
...
</wsa:ReplyTo>These allow message addressing information to be represented independently of the underlying transport.
53. Why Message-Level Addressing Matters
Suppose:
Client
|
v
Message Queue
|
v
Router
|
v
ServiceThe original message may not have a direct HTTP connection to the ultimate recipient.
WS-Addressing allows the message itself to contain information such as:
Message ID
Destination
Action
Reply endpoint
Fault endpoint
RelationshipThis makes the messaging model less dependent on HTTP.
54. WS-ReliableMessaging
Network communication can fail.
For example:
Client
|
| message
v
Network
XThe sender needs to know:
Was it delivered?
Was it duplicated?
Was it delivered in order?WS-ReliableMessaging provides a protocol for reliable message transfer across failures, including mechanisms for identifying and managing message sequences. It is designed to be transport-independent and includes a SOAP binding.
This can address requirements such as:
reliable delivery
duplicate detection
message ordering55. Why HTTP/TCP Reliability Is Not Enough
TCP provides:
ordered byte stream
retransmission
connection reliabilityBut TCP does not tell an application:
"Your business message was processed exactly once."Consider:
Client
|
| CreatePayment
v
Server
|
| processes payment
|
X response lost
|
Client timeoutThe client cannot automatically know whether:
payment failedor:
payment succeeded but response was lostApplication-level reliable messaging and idempotency are therefore different from TCP reliability.
56. WS-Policy
WS-Policy allows services to express requirements and capabilities.
Conceptually:
Service policy:
Must use WS-Security
Must sign SOAP Body
Must encrypt specific elements
Must use a particular token
Must support a particular bindingA client can use the policy to determine how it must interact with the service.
Therefore:
WSDL
describes service interface
WS-Policy
describes applicable requirements/capabilitiesThey can be combined.
57. WS-Transaction Specifications
Enterprise systems sometimes need distributed transaction semantics.
The WS-* ecosystem historically included specifications such as:
WS-Coordination
WS-AtomicTransaction
WS-BusinessActivityThese address distributed coordination and transaction scenarios.
They should not be confused with database transactions.
A database transaction might be:
BEGIN
UPDATE A
UPDATE B
COMMITA distributed transaction can involve:
Service A
|
+---- Service B
|
+---- Service Cand therefore requires coordination across distributed participants.
58. Attachments
XML is inefficient for some binary payloads.
Suppose a SOAP operation needs to transfer:
PDF
image
video
large binary documentBase64 encoding can represent binary data inside XML:
<document>
JVBERi0xLjQK...
</document>but increases size and requires XML processing.
SOAP systems therefore developed attachment mechanisms.
59. MTOM
MTOM = Message Transmission Optimization Mechanism
MTOM allows binary data to be transmitted efficiently while still being represented logically as part of the SOAP message.
Conceptually:
SOAP XML
|
+-- logical reference to binary content
|
+----------------------+
|
v
Binary attachmentThe binary data does not need to be base64-encoded directly into the XML representation.
MTOM is particularly important when SOAP services exchange:
large documents
images
files
binary business data60. SOAP Message Structure with WS-* Extensions
A realistic enterprise SOAP message may look conceptually like:
<soap:Envelope>
<soap:Header>
<!-- WS-Addressing -->
<wsa:MessageID>
uuid:...
</wsa:MessageID>
<wsa:To>
...
</wsa:To>
<wsa:Action>
...
</wsa:Action>
<!-- WS-Security -->
<wsse:Security>
...
</wsse:Security>
<!-- Reliability -->
<wsrm:Sequence>
...
</wsrm:Sequence>
</soap:Header>
<soap:Body>
<m:GetCustomer>
...
</m:GetCustomer>
</soap:Body>
</soap:Envelope>This illustrates the fundamental SOAP design:
Core SOAP
+
modular extensions61. SOAP vs HTTP
This distinction is essential.
| SOAP | HTTP |
|---|---|
| Message protocol | Application protocol |
| XML message model | HTTP message model |
| Envelope/Header/Body | Start-line/fields/content |
| SOAP Fault | HTTP status code |
| SOAP headers | HTTP headers |
| Can be bound to HTTP | Can carry many payload types |
| Defines processing model | Defines request/response semantics |
| Supports SOAP-specific extensions | Supports HTTP extensions |
| Can theoretically use other bindings | Not dependent on SOAP |
Example:
POST /customer HTTP/1.1
Content-Type: application/soap+xmlThe above is an HTTP request.
Its body may contain:
<soap:Envelope>
...
</soap:Envelope>That XML is the SOAP message.
62. SOAP vs REST
The distinction is even more important.
REST
architectural style
SOAP
protocolREST commonly uses:
HTTPSOAP can use:
HTTPTherefore:
REST over HTTP
and
SOAP over HTTPare completely different architectural/protocol approaches.
63. REST Resource Model vs SOAP Operation Model
REST generally starts with:
ResourceFor example:
/customer/123Operations are expressed using HTTP methods:
GET /customer/123
PUT /customer/123
DELETE /customer/123SOAP commonly starts with:
Service operationFor example:
GetCustomer
CreateCustomer
UpdateCustomer
DeleteCustomerThe request may be:
<GetCustomer>
<customerId>123</customerId>
</GetCustomer>Therefore:
REST:
resource-oriented
SOAP:
service/operation-orientedThis is a simplification, because SOAP can also be document-oriented rather than RPC-oriented.
64. REST and SOAP Are Not Opposite Protocol Versions
It is incorrect to think:
HTTP -> REST
HTTP -> SOAPas though REST and SOAP were competing versions of HTTP.
A better model is:
Application architecture
|
+---------+---------+
| |
REST Other
|
v
HTTPand independently:
SOAP
|
v
protocol binding
|
v
HTTPTherefore HTTP can participate in both.
65. SOAP and REST: Detailed Comparison
| Property | REST | SOAP |
|---|---|---|
| Nature | Architectural style | Protocol |
| Core abstraction | Resource | Message / operation / document |
| Typical transport | HTTP | HTTP, potentially others |
| Typical format | JSON, XML, etc. | XML |
| Contract | Optional | Often WSDL |
| Interface style | Uniform interface | Explicit operations |
| Errors | HTTP status + representation | SOAP Fault + transport status |
| Security | Usually TLS + HTTP mechanisms | TLS and/or WS-Security |
| Reliability | Application design | WS-ReliableMessaging etc. |
| Addressing | HTTP URI | URI + optional WS-Addressing |
| Binary data | HTTP mechanisms | MTOM/SWA etc. |
| Extensibility | HTTP/media type mechanisms | SOAP headers/modules/WS-* |
| Hypermedia | REST constraint | Not intrinsic |
| Strong schema contracts | Optional | Common |
| Generated clients | Optional | Very common |
| Enterprise WS-* stack | No | Yes |
66. SOAP Is Not "Just XML over HTTP"
This statement is common but incomplete.
A very simple SOAP deployment may look like:
HTTP
+
XMLbut SOAP defines significantly more:
SOAP
|
+-- Envelope
|
+-- Header processing
|
+-- Body
|
+-- Faults
|
+-- Processing model
|
+-- Message Exchange Patterns
|
+-- Protocol binding framework
|
+-- Extensibility modelFurthermore, enterprise SOAP commonly incorporates:
WSDL
XML Schema
WS-Security
WS-Addressing
WS-ReliableMessaging
WS-Policy
MTOM
etc.Therefore:
XML over HTTPis not necessarily SOAP.
For example:
POST /api HTTP/1.1
Content-Type: application/xmlwith arbitrary XML in the body does not automatically constitute SOAP.
67. SOAP Request Processing — End to End
Consider:
Application
|
| getCustomer(123)
v
Generated Proxy
|
| serialize parameters
v
SOAP Runtime
|
| create Envelope
| create Headers
| create Body
v
XML Serializer
|
v
HTTP Client
|
v
TCP / TLS
|
v
NetworkAt the server:
Network
|
v
TLS
|
v
HTTP Server
|
v
SOAP Runtime
|
+-- parse Envelope
|
+-- process Headers
|
+-- verify security
|
+-- verify addressing
|
+-- verify reliability
|
+-- deserialize Body
|
v
Service Dispatch
|
v
Business LogicThe response reverses the process.
68. Byte-Level View of SOAP over HTTP
At the wire, SOAP over HTTP still consists of HTTP bytes.
For example:
50 4F 53 54 20 2F 63 75 73 74 6F 6D 65 72 ...which begins:
POST /customer ...The HTTP body then contains bytes representing XML.
For example:
3C 73 6F 61 70 3A 45 6E 76 65 6C 6F 70 65 ...which corresponds to:
<soap:Envelope...Thus:
HTTP
sees:
byte sequence
SOAP
interprets:
XML SOAP messageSOAP does not replace HTTP's byte transport.
It defines the semantics of the payload and message processing.
69. SOAP over HTTP/1.1
Conceptually:
HTTP/1.1 message
│
├── Request line
├── HTTP headers
├── blank line
└── SOAP XML bytesFor example:
POST /service HTTP/1.1
Host: example.com
Content-Type: application/soap+xml
Content-Length: 800
<soap:Envelope>
...
</soap:Envelope>The HTTP parser stops interpreting at the HTTP message boundary.
The SOAP implementation then receives the entity/content bytes.
70. SOAP over HTTP/2
SOAP is not intrinsically tied to HTTP/1.1.
SOAP can be transported using HTTP/2 infrastructure when the relevant binding and implementation support it.
The conceptual layers remain:
SOAP XML message
|
v
HTTP/2
|
v
TLS
|
v
TCPHTTP/2 changes the HTTP wire framing:
HTTP/1.1
text-oriented message syntax
HTTP/2
binary frames
streams
multiplexing
HPACKbut does not fundamentally change the SOAP envelope.
71. SOAP and HTTP/3
The same conceptual separation applies to HTTP/3:
SOAP
|
v
HTTP/3
|
v
QUIC
|
v
UDP
|
v
IPThe SOAP message model does not become an HTTP/3 protocol.
HTTP/3 changes the transport/application framing beneath the SOAP interaction.
72. SOAP and Stateful Applications
SOAP itself does not make an application stateless.
For example:
SOAP request
|
v
Server session
|
+-- server-side statecan exist.
SOAP can carry:
session ID
correlation ID
security context
transaction contextthrough headers or application data.
This differs from REST's formal stateless architectural constraint.
73. SOAP and Idempotency
SOAP does not automatically make operations idempotent.
Consider:
CreatePayment()If the client retries:
CreatePayment()the operation might execute twice.
Enterprise SOAP systems can address this using:
message identifiers
reliable messaging
application-level idempotency keys
transaction mechanismsThe important principle is:
transport reliability
≠
business operation idempotency74. SOAP and Transactions
SOAP itself does not automatically provide ACID transactions.
A distributed transaction requires additional mechanisms.
Conceptually:
SOAP
|
+-- transaction-related WS-* specificationsrather than:
SOAP = transaction protocolThis distinction is important when reading enterprise architecture diagrams.
75. SOAP and Service Discovery
SOAP does not inherently define:
Where can I discover services?Historically, SOAP ecosystems included technologies such as:
UDDIfor service discovery.
In modern deployments, service locations are more commonly supplied through:
WSDL
configuration
service registries
DNS
API gateways
enterprise service infrastructureDiscovery is therefore separate from the core SOAP message protocol.
76. SOAP and RESTful HTTP Semantics
SOAP often uses:
POSTfor many operations.
For example:
POST /CustomerServicecould carry:
<GetCustomer>or:
<DeleteCustomer>or:
<CreateCustomer>The operation is represented in the SOAP message.
REST instead attempts to exploit HTTP's standardized method semantics:
GET
POST
PUT
PATCH
DELETETherefore:
SOAP:
operation semantics inside SOAP message
REST:
operation semantics strongly tied to HTTP method semantics77. SOAP and HTTP Caching
HTTP provides caching semantics.
SOAP messages are generally much less naturally cacheable because many SOAP operations are:
POSTand may represent commands or RPC operations.
For example:
POST /CustomerService
<GetCustomer/>does not automatically provide the same cache semantics as:
GET /customers/123This is one reason REST's use of HTTP semantics can be advantageous for cacheable resource retrieval.
78. SOAP and Content Negotiation
REST commonly uses HTTP content negotiation:
Accept: application/jsonSOAP generally has a more strongly defined XML contract through:
WSDL
+
XML Schema
+
SOAP bindingSOAP 1.2 normally uses:
Content-Type: application/soap+xmlThe message's XML schema determines the structure of the payload.
79. SOAP Namespaces
Namespaces are essential to SOAP.
For example:
xmlns:soap=
"http://www.w3.org/2003/05/soap-envelope"and:
xmlns:m=
"http://example.com/customer"allow the document to distinguish:
SOAP vocabularyfrom:
application vocabularyThe namespace URI is the identifier.
The prefix is merely syntactic shorthand.
Therefore:
<s:Envelope>and:
<soap:Envelope>can mean exactly the same thing.
80. SOAP Version Identification
SOAP version is determined by the envelope namespace.
SOAP 1.1:
http://schemas.xmlsoap.org/soap/envelope/SOAP 1.2:
http://www.w3.org/2003/05/soap-envelopeTherefore a SOAP processor can identify the SOAP version from the envelope namespace.
This is analogous to protocol version identifiers elsewhere in network protocols.
81. SOAP Message Processing Errors
A SOAP processor may fail before application business logic executes.
For example:
Malformed XML
|
v
XML parsing failure
Unknown mandatory header
|
v
MustUnderstand failure
Wrong SOAP namespace
|
v
VersionMismatch
Invalid message structure
|
v
SOAP processing failureOnly after SOAP processing succeeds does the application operation necessarily execute.
This creates a useful conceptual pipeline:
Transport validation
|
v
XML validation/parsing
|
v
SOAP processing
|
v
SOAP extension processing
|
v
Application processing82. SOAP Fault vs Business Error
Consider:
GetCustomer(123)and suppose customer 123 does not exist.
There are several possible designs.
SOAP Fault
SOAP processing result:
Fault
Detail:
CustomerNotFoundSuccessful SOAP response carrying a business result
<GetCustomerResponse>
<status>NOT_FOUND</status>
</GetCustomerResponse>The appropriate design depends on the contract.
A fault generally represents an error condition at the SOAP/service contract level, while application-specific result structures can represent ordinary business outcomes.
83. WSDL Faults
WSDL can formally describe operation faults.
Conceptually:
<wsdl:operation name="GetCustomer">
<wsdl:input
message="tns:GetCustomerRequest"/>
<wsdl:output
message="tns:GetCustomerResponse"/>
<wsdl:fault
name="CustomerNotFound"
message="tns:CustomerNotFoundFault"/>
</wsdl:operation>This lets generated client libraries potentially expose typed exceptions.
For example:
try {
client.getCustomer(123);
}
catch (CustomerNotFoundException e) {
...
}The exact programming-language representation depends on the SOAP toolchain.
84. Strong Contract Typing
A typical SOAP contract can define:
Operation
|
+-- input message
|
+-- output message
|
+-- fault messagesand:
Message
|
+-- XML elements
|
+-- XML Schema typesThis creates a strongly described interface:
WSDL
+
XSD
=
formal service contractThis is one of the biggest reasons SOAP became important in large enterprise environments.
85. Stub Generation
Given:
service.wsdla tool can generate:
Client
|
+-- Proxy
+-- Request types
+-- Response types
+-- Fault typesand potentially:
Server
|
+-- Interface
+-- Request deserializers
+-- Response serializersThis dramatically reduces manual protocol implementation.
86. Why SOAP Can Be Attractive in Large Enterprises
SOAP is particularly strong when an organization needs:
formal contracts
strong XML schemas
generated clients
message-level security
standardized headers
reliable messaging
formal policies
transaction coordination
intermediaries
complex enterprise integrationThe trade-off is complexity.
A simple service may become:
WSDL
+
XSD
+
SOAP
+
WS-Security
+
WS-Addressing
+
WS-Policy
+
WS-ReliableMessagingThis is powerful but significantly more complicated than:
HTTP
+
JSON87. SOAP Complexity
SOAP's architecture can become layered:
Application
|
v
WSDL
|
+---------+---------+
| |
SOAP XSD
|
+-----+-----+
| | |
Security Addr Reliability
| | |
+-----+-----+
|
v
HTTP
|
v
TLS
|
v
TCPThis is both SOAP's strength and weakness.
You can compose sophisticated capabilities.
But every additional specification introduces:
more metadata
more processing
more configuration
more interoperability considerations
more failure modes88. SOAP Performance Considerations
SOAP's main performance costs traditionally come from:
XML verbosity
XML parsing
schema validation
serialization/deserialization
namespace processing
security processing
signature generation
encryption
large message envelopesFor example:
{"id":123,"name":"Alice"}is considerably smaller than a deeply namespaced XML document representing the same logical data.
This does not mean SOAP is inherently slow.
A SOAP service can be highly performant.
It means:
SOAP optimizes for standardized enterprise messaging features,
not minimum message size.89. XML Parsing Security
SOAP applications must consider XML-specific security risks.
Important categories include:
XXE
XML entity expansion
XML bombs
oversized messages
deeply nested XML
signature wrapping attacks
parser resource exhaustionModern parsers and SOAP frameworks generally provide defenses, but secure configuration remains important.
90. XML Signature Wrapping
SOAP's extensibility and XML signature model introduce specialized security concerns.
A simplified attack pattern is:
Signed SOAP element
|
+---- attacker moves/copies element
|
v
Application processes a different elementThe cryptographic signature may still validate against the original signed element while application logic processes attacker-controlled content.
Therefore:
"Signature validates"does not automatically imply:
"Application processed exactly the intended element."SOAP security implementations need correct signature-reference and processing semantics.
91. WS-Security vs OAuth
These technologies operate at different architectural levels.
OAuth is primarily an authorization framework.
WS-Security is a SOAP message-security framework.
They are not direct substitutes.
A SOAP enterprise system may use:
TLS
+
WS-Security
+
SAMLwhile a modern HTTP API might use:
TLS
+
OAuth 2.0
+
JWTThe choice depends on architecture and trust boundaries.
92. SOAP and Microservices
SOAP predates the modern microservices movement.
It can technically be used in microservice architectures:
Service A
|
| SOAP
v
Service Bbut its ecosystem is more commonly associated with:
enterprise integration
SOA
legacy enterprise applications
B2B systems
financial systems
telecommunications
government systemsThe protocol itself does not require a particular deployment architecture.
93. SOAP and Service-Oriented Architecture
SOAP and SOA are frequently conflated.
They are not equivalent.
SOA
architectural approach
SOAP
messaging protocolSOA can use SOAP.
SOAP can be used without implementing a complete SOA architecture.
Similarly:
REST ≠ SOA
SOAP ≠ SOAThey exist at different conceptual levels.
94. SOAP and RPC
RPC means:
Remote Procedure CallSOAP can encode RPC-style interactions.
For example:
GetCustomer(123)can be represented as a SOAP message.
But:
SOAP ≠ RPCSOAP can carry document-oriented messages and arbitrary structured information.
95. SOAP and gRPC
SOAP and gRPC have some conceptual similarities:
formal contracts
generated clients
generated servers
strongly defined messages
RPC-style operationsbut their protocol stacks are very different.
Typical gRPC:
Protocol Buffers
+
HTTP/2
+
gRPC semanticsTypical SOAP:
XML Schema
+
WSDL
+
SOAP
+
HTTP
+
WS-* extensionsgRPC generally emphasizes:
compact binary serialization
high-performance RPC
modern service-to-service communicationSOAP emphasizes:
formal XML contracts
extensible message headers
enterprise WS-* specifications
interoperable message-level features96. SOAP and GraphQL
GraphQL is also not simply an alternative version of SOAP.
GraphQL provides:
query language
schema
execution modelA typical GraphQL request is:
query {
customer(id: 123) {
id
name
}
}SOAP instead typically uses:
operation
+
strong XML message schema
+
WSDL contractThey solve different problems.
97. SOAP and WebSockets
WebSockets provide:
persistent bidirectional communicationSOAP primarily provides:
structured message exchangeA SOAP system does not inherently provide a WebSocket-style full-duplex channel.
Again:
SOAP
message protocol
WebSocket
communication protocolThey can theoretically be combined through appropriate bindings or application frameworks, but they address different concerns.
98. SOAP and JSON
SOAP's canonical representation is XML.
For example:
<soap:Envelope>
<soap:Body>
...
</soap:Body>
</soap:Envelope>JSON is not the normal SOAP message representation.
Therefore:
REST API
commonly:
JSON
SOAP service
normally:
XMLThe distinction is not merely stylistic.
SOAP's XML representation supports:
namespaces
XML Schema
XML Signature
XML Encryption
structured headers
formal XML contractswhich form a large part of the SOAP ecosystem.
99. SOAP and HTTP Methods
SOAP-over-HTTP commonly uses:
POSTThe actual operation is usually represented inside the SOAP message.
For example:
POST /CustomerServicewith:
<GetCustomer>inside the SOAP Body.
This differs from REST:
GET /customers/123where the HTTP method itself carries standardized semantics.
100. SOAP URI vs REST URI
In REST:
/customers/123is normally interpreted as identifying a resource.
In SOAP:
/CustomerServicemay identify a service endpoint.
The operation can then be:
<GetCustomer>inside the SOAP message.
Therefore:
REST URI:
commonly resource-oriented
SOAP endpoint:
commonly service-oriented101. A Complete SOAP Request
Consider:
POST /CustomerService HTTP/1.1
Host: api.example.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1000Body:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/..."
xmlns:m="http://example.com/customer">
<soap:Header>
<wsa:MessageID>
uuid:12345678
</wsa:MessageID>
<wsa:To>
https://api.example.com/CustomerService
</wsa:To>
<wsa:Action>
http://example.com/customer/GetCustomer
</wsa:Action>
<wsse:Security>
...
</wsse:Security>
</soap:Header>
<soap:Body>
<m:GetCustomer>
<m:customerId>12345</m:customerId>
</m:GetCustomer>
</soap:Body>
</soap:Envelope>This one message can therefore contain:
HTTP
transport/application protocol
SOAP
messaging framework
WS-Addressing
message addressing
WS-Security
message security
Application XML
business requestThis layered composition is central to SOAP.
102. A Complete SOAP Response
Conceptually:
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8Body:
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:m="http://example.com/customer">
<soap:Header>
...
</soap:Header>
<soap:Body>
<m:GetCustomerResponse>
<m:customer>
<m:id>12345</m:id>
<m:name>Alice</m:name>
<m:email>
alice@example.com
</m:email>
</m:customer>
</m:GetCustomerResponse>
</soap:Body>
</soap:Envelope>The SOAP response remains an XML document with the same envelope structure.
103. SOAP Fault Response
An error could instead result in:
HTTP/1.1 500 Internal Server Error
Content-Type: application/soap+xmlBody:
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>
soap:Sender
</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">
Invalid customer ID.
</soap:Text>
</soap:Reason>
<soap:Detail>
...
</soap:Detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>This demonstrates the two-level model:
HTTP:
500
SOAP:
Fault104. SOAP Message Anatomy
A useful mental model is:
SOAP Message
|
+------+------+
| |
Header Body
| |
+-------+------+ |
| | | |
Security Address Reliability
|
v
Application Data
|
+-----------+-----------+
| |
Request Response
|
+-- or Fault105. SOAP Core vs WS-* Stack
Keep these layers separate.
+----------------------------------------+
| Application |
+----------------------------------------+
| WSDL / XSD |
+----------------------------------------+
| WS-Security / WS-Addressing / etc. |
+----------------------------------------+
| SOAP |
+----------------------------------------+
| HTTP |
+----------------------------------------+
| TLS |
+----------------------------------------+
| TCP / QUIC |
+----------------------------------------+
| IP |
+----------------------------------------+Not every deployment contains every layer.
For example:
SOAP
+
HTTPis a valid simple deployment.
Another might be:
SOAP
+
WS-Security
+
WS-Addressing
+
WS-ReliableMessaging
+
WS-Policy
+
HTTP
+
TLS106. Important Terminology
SOAP Node
A participant that processes SOAP messages.
SOAP Message
A message conforming to the SOAP messaging framework.
Envelope
The outermost SOAP XML element.
Header
Optional SOAP metadata containing header blocks.
Body
Required SOAP element containing the primary message content.
Fault
SOAP-defined representation of a processing failure.
SOAP Module
An extension defining syntax and semantics for SOAP header blocks and processing behavior.
Binding
Specification of how SOAP messages are exchanged using an underlying protocol.
Message Exchange Pattern
A defined pattern for exchanging SOAP messages.
WSDL
A formal description of a web service interface and concrete deployment information.
XML Schema
The type system commonly used to define SOAP payload structures.
107. Common Misconceptions
"SOAP is XML."
Incorrect.
SOAP uses XML, but SOAP is a protocol and processing model.
"SOAP is HTTP."
Incorrect.
HTTP is commonly used as a transport/application protocol binding for SOAP.
"SOAP requires HTTP."
Incorrect.
SOAP 1.2 explicitly defines a protocol-binding framework intended to support underlying protocols other than HTTP.
"SOAP is always RPC."
Incorrect.
SOAP supports RPC-style and document-oriented messaging.
"SOAP automatically provides security."
Incorrect.
SOAP's core messaging framework does not itself provide complete confidentiality, integrity, authentication, or authorization.
WS-Security and transport security can provide those capabilities.
"WSDL is SOAP."
Incorrect.
WSDL describes services.
SOAP defines a message protocol.
"WSDL is required by SOAP."
Incorrect.
SOAP messages can exist without WSDL.
WSDL is commonly used to describe SOAP-based services.
"SOAP and REST are competing versions of HTTP."
Incorrect.
REST is an architectural style.
SOAP is a protocol.
Both can use HTTP.
"SOAP is inherently stateful."
Incorrect.
SOAP does not require stateful applications.
"SOAP is inherently unreliable."
Incorrect.
The base SOAP framework does not guarantee reliable business message delivery, but WS-ReliableMessaging and application mechanisms can provide stronger guarantees.
108. SOAP's Architectural Philosophy
SOAP's design can be summarized as:
Keep the core messaging framework relatively small.
Add advanced capabilities through extensions/modules.Therefore:
SOAP Core
|
+-- addressing
+-- security
+-- reliability
+-- transactions
+-- policy
+-- attachments
+-- other featuresThis is conceptually similar to a modular protocol architecture.
109. Why the WS-* Ecosystem Became Large
Enterprise systems have requirements that ordinary HTTP request/response semantics do not directly solve.
For example:
How do I sign one XML element?
How do I encrypt only part of a message?
How do I route a message through intermediaries?
How do I identify the ultimate destination?
How do I correlate messages?
How do I guarantee message delivery?
How do I detect duplicates?
How do I express service security requirements?
How do I coordinate distributed transactions?Instead of modifying SOAP itself for every problem, specifications were built around the SOAP extension model.
That produced the WS-* ecosystem.
110. SOAP as a Message-Oriented Architecture
A useful way to think about SOAP is:
SOAP is not fundamentally an RPC framework.
SOAP is a structured message framework
that can support RPC and document messaging.The message is primary.
RPC is one possible interpretation of the message.
This distinction becomes especially important when studying:
WS-Addressing
WS-ReliableMessaging
WS-Security
intermediaries
asynchronous messaging111. Synchronous vs Asynchronous SOAP
SOAP does not fundamentally require synchronous communication.
Synchronous
Client
|
| Request
v
Server
|
| Response
v
ClientAsynchronous
Client
|
| Message
v
Queue / intermediary
|
v
Service
|
| later response
v
Callback endpointWS-Addressing can be useful in such architectures because the response destination can be represented as message-level metadata.
112. Correlation
Distributed systems often require:
Request A
|
v
Response A
Request B
|
v
Response BA message ID can be used to correlate messages.
Conceptually:
MessageID:
123
Reply:
relatesTo = 123This becomes particularly useful when:
responses are asynchronous
multiple messages are in flight
intermediaries exist
transport connections are not persistent113. SOAP and Intermediaries — Practical Example
Consider:
Client
|
v
Internet Gateway
|
v
Security Service
|
v
Message Router
|
v
Business ServiceA SOAP message could contain:
Security Header
-> processed by security node
Routing Header
-> processed by router
Application Body
-> processed by business serviceThis is a much richer model than:
HTTP request -> application114. SOAP and Enterprise Integration
SOAP is particularly useful when several organizations need a formally specified interface.
For example:
Bank
|
| SOAP
v
Insurance companyBoth sides can agree on:
WSDL
XSD
security policy
message structure
fault contract
addressing
reliabilityThe implementation languages can differ:
Java
C#
C++
Python
COBOL
etc.provided they correctly implement the agreed contract.
This language-neutral contract was one of SOAP's major selling points.
115. SOAP Interoperability
Theoretically:
Java SOAP client
|
v
C# SOAP servicecan interoperate.
But interoperability is not guaranteed merely because both systems say "SOAP."
Potential incompatibilities include:
SOAP 1.1 vs SOAP 1.2
document vs RPC
literal vs encoded
different XSD interpretations
WS-* version differences
WS-Addressing differences
WS-Security profile differences
namespace mismatches
binding differences
fault differencesThis is why interoperability profiles and standardized contracts matter.
116. Contract Compatibility
Changing a SOAP service contract can break clients.
For example:
<customerId>changing to:
<customerID>may break schema validation.
Likewise:
intchanging to:
stringcan alter generated client types.
SOAP systems therefore place considerable emphasis on:
schema compatibility
WSDL compatibility
versioning
namespace management117. XML Namespace Versioning
A common strategy is to use namespaces to distinguish versions.
For example:
http://example.com/customer/v1and:
http://example.com/customer/v2This allows a service to maintain separate contracts.
Conceptually:
v1 client
|
+----> v1 namespace
v2 client
|
+----> v2 namespaceNamespaces therefore become part of service versioning strategy.
118. SOAP and API Gateways
A SOAP deployment may contain:
Client
|
v
API Gateway
|
v
SOAP ServiceThe gateway can perform:
TLS termination
authentication
authorization
rate limiting
logging
routing
schema validation
message transformationSOAP's header model can integrate with intermediary processing.
119. SOAP and Message Transformation
An intermediary might transform:
SOAP v1.1into:
SOAP v1.2or transform:
SOAPinto:
internal application protocolor:
SOAP/XMLinto:
REST/JSONThis is common in modernization architectures.
For example:
Legacy SOAP
|
v
Integration Gateway
|
v
Modern REST API
|
v
MicroserviceThe gateway acts as a protocol translation boundary.
120. SOAP-to-REST Migration
A common modernization pattern is:
Legacy SOAP
|
v
Adapter
|
v
REST API
|
v
Modern serviceThe adapter may translate:
SOAP Envelope
|
v
SOAP Body
|
v
REST JSONand responses in the opposite direction.
However, the transformation is not always one-to-one because SOAP may contain:
WS-Security
WS-Addressing
WS-ReliableMessaging
typed faults
headers
complex XML schemasthat have no direct HTTP/JSON equivalent.
121. SOAP vs REST — Architectural Trade-Off
A simplified comparison:
SOAP
Strengths:
formal contracts
rich extensibility
message-level security
enterprise standards
strong schemas
generated clients
sophisticated messaging
Costs:
XML verbosity
complexity
larger toolchain
difficult debugging
substantial standards ecosystemREST/HTTP
Strengths:
simpler
HTTP-native
cache-friendly
broadly supported
easy browser/tool integration
JSON-friendly
simple operational model
Costs:
fewer standardized enterprise message extensions
contracts often less formal
advanced messaging features require additional designNeither is universally superior.
The correct choice depends on system requirements.
122. A Useful Layered Mental Model
When studying SOAP, keep these layers separate:
Layer 1 — Business contract
What does the service actually do?
Layer 2 — WSDL
What operations/messages/types exist?
Layer 3 — XML Schema
What does the data look like?
Layer 4 — SOAP
How is the message packaged and processed?
Layer 5 — WS-* modules
How are security/addressing/reliability/etc. added?
Layer 6 — Binding
How does SOAP travel over a protocol?
Layer 7 — HTTP
How are bytes transported/application messages exchanged?
Layer 8 — TLS
How is the communication channel protected?
Layer 9 — TCP/QUIC
How are bytes transported?
Layer 10 — IP
How are packets routed?The exact OSI mapping should not be interpreted literally, but the separation of concerns is useful.
123. SOAP in One Diagram
BUSINESS LOGIC
|
v
WSDL CONTRACT
|
+------------+------------+
| |
XML Schema Operations
| |
+------------+------------+
|
v
SOAP MESSAGE
|
+-------------+-------------+
| |
Header Body
| |
+-------+-------+ |
| | | |
Security Address Reliability |
|
v
Application XML
|
v
SOAP HTTP Binding
|
v
HTTP
|
v
TLS
|
v
TCP / QUIC
|
v
IP124. What You Should Memorize
For an in-depth understanding, the following distinctions are fundamental.
SOAP
Protocol / messaging frameworkHTTP
Application protocol commonly carrying SOAPREST
Architectural styleXML
Markup/data representation technology used by SOAPXML Schema
Type/schema system commonly used to define SOAP dataWSDL
Formal service description/contractWS-Security
SOAP message security extensionsWS-Addressing
Message-level addressingWS-ReliableMessaging
Reliable message-transfer protocolWS-Policy
Policy/capability expressionMTOM
Optimized binary-data transmission for SOAP125. Standards Worth Knowing
For serious SOAP work, these are the most useful specifications to understand.
Core SOAP
SOAP 1.1
W3C Note, 2000
Important for understanding legacy SOAP implementations.
SOAP 1.2 Part 1
W3C Recommendation
Defines:
- processing model
- extensibility model
- protocol binding framework
- message construct
SOAP 1.2 Part 2
Defines additional SOAP adjuncts, including mechanisms related to encoding and RPC conventions.
Service Description
WSDL 1.1
Extremely important historically and in deployed enterprise systems.
Understand:
types
message
portType
binding
service
portWSDL 2.0
Understand:
types
interface
binding
service
endpointXML
Understand:
XML Namespaces
XML Schema
XML Infoset
XML Signature
XML EncryptionSOAP Extensions
Understand conceptually:
WS-Security
WS-Addressing
WS-ReliableMessaging
WS-Policy
WS-Coordination
WS-AtomicTransaction
MTOMYou do not need to memorize every WS-* specification.
Understand why each exists and which problem it solves.
126. Recommended Learning Order
For an in-depth understanding, study SOAP in this order:
1. XML
|
v
2. XML Namespaces
|
v
3. XML Schema
|
v
4. SOAP Envelope
|
v
5. SOAP Header / Body
|
v
6. SOAP Processing Model
|
v
7. SOAP Faults
|
v
8. SOAP HTTP Binding
|
v
9. SOAP 1.1 vs SOAP 1.2
|
v
10. WSDL 1.1
|
v
11. WSDL 2.0
|
v
12. Document vs RPC
|
v
13. Literal vs Encoded
|
v
14. WS-Addressing
|
v
15. WS-Security
|
v
16. WS-ReliableMessaging
|
v
17. WS-Policy
|
v
18. MTOM
|
v
19. Enterprise interoperability
|
v
20. SOAP vs RESTThis order is preferable to starting with WSDL because WSDL becomes considerably easier to understand once the underlying SOAP message is familiar.
127. Final Conceptual Model
The most useful way to think about SOAP is:
SOAP is a standardized message-processing framework
for exchanging structured information between distributed nodes.It provides:
Envelope
Header
Body
Fault
Processing model
Extensibility model
Protocol-binding modelWSDL then provides:
Service contractXML Schema provides:
Data modelWS-* specifications add:
Security
Addressing
Reliability
Policy
Transactions
Other enterprise messaging capabilitiesHTTP commonly provides:
The protocol binding carrying SOAPTLS can provide:
Channel securityAnd TCP/QUIC provides:
Underlying transportThe complete conceptual stack is therefore:
BUSINESS SERVICE
|
v
WSDL
|
v
XML Schema / XSD
|
v
SOAP Message
|
+-------------+-------------+
| | |
Security Addressing Reliability
| | |
+-------------+-------------+
|
v
SOAP Binding
|
v
HTTP
|
v
TLS
|
v
TCP / QUIC
|
v
IPAnd the most important distinction from the previous REST discussion is:
REST:
architectural constraints applied to
distributed application architecture
SOAP:
protocol defining a structured
message-processing frameworkwhile:
HTTP:
application protocol that can carry
either REST-oriented interactions,
SOAP messages, or arbitrary other
application data.That distinction prevents most of the common conceptual confusion surrounding REST, SOAP, and HTTP.
128. Primary References
The following specifications are the most important references for deeper study.
W3C — SOAP 1.1
- W3C Note, 8 May 2000
- Understand the original envelope, header, body, fault, encoding, RPC, and HTTP binding model.
W3C — SOAP Version 1.2 Part 1: Messaging Framework
- W3C Recommendation, Second Edition, 27 April 2007
- The primary specification for the SOAP 1.2 messaging framework.
W3C — SOAP Version 1.2 Part 2
- SOAP adjuncts including encoding/RPC-related mechanisms.
W3C — Web Services Description Language 1.1
- Important for understanding the historically dominant WSDL model.
W3C — Web Services Description Language 2.0 Part 1: Core Language
- Modernized WSDL component model.
OASIS — Web Services Security
- SOAP message security and security-token mechanisms.
W3C — Web Services Addressing
- Message-level addressing and endpoint references.
OASIS — WS-ReliableMessaging
- Reliable message transfer, sequencing, and related mechanisms.
W3C — MTOM
- Optimized binary transmission for SOAP messages.
XML Schema
- Fundamental to understanding typed SOAP/WSDL contracts.
129. Short Version
If the entire document had to be reduced to one diagram:
REST
= architectural style
SOAP
= messaging protocol
WSDL
= service contract
XSD
= data/schema definition
WS-Security
= message security
WS-Addressing
= message addressing
WS-ReliableMessaging
= reliable message transfer
HTTP
= common SOAP binding / application protocol
TLS
= channel security
TCP/QUIC
= transportAnd:
SOAP ECOSYSTEM
+-------------------+
| Application |
+-------------------+
|
+-------------------+
| WSDL |
| + XSD |
+-------------------+
|
+------------------+------------------+
| | |
WS-Security WS-Addressing WS-ReliableMessaging
| | |
+------------------+------------------+
|
+-------------------+
| SOAP |
| Envelope/Header |
| Body/Fault |
+-------------------+
|
+-------------------+
| HTTP |
+-------------------+
|
+-------------------+
| TLS / TCP |
+-------------------+
|
+-------------------+
| IP |
+-------------------+That is the conceptual model to retain.
