Software-Engineering

SOAP (Simple Object Access Protocol)

What is SOAP?

SOAP is a protocol for exchanging structured information in the implementation of web services in computer networks. It relies on XML as 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.

Unlike REST, which is an architectural style, SOAP is a strict protocol with a formal specification.

How it Works

SOAP is highly structured and relies heavily on XML.

  1. WSDL (Web Services Description Language): A SOAP service is described by a WSDL file. This XML document describes what the service does, the operations it supports, and the data types it expects. It serves as a strict contract.
  2. Envelope: SOAP messages are XML documents wrapped in an “Envelope”.
    • Header: Optional meta-information (security, transactions).
    • Body: The actual message content (call and response).
  3. Transport: While usually sent over HTTP, SOAP is transport-agnostic and can be sent over SMTP, TCP, or JMS.

Why We Need It & When to Use

SOAP is considered “legacy” by many modern web developers, but it is still critical in enterprise environments.

Use SOAP when:

Other Options

Pros and Cons

Pros

Cons