CodeBlog.xyz

SOAP (Simple Object Access Protocol) – 20 basic consepts

September 23, 2023 | by Meir Achildiev

SOAP (Simple Object Access Protocol) – 20 basic consepts

SOAP (Simple Object Access Protocol) is a protocol for exchanging structured information in the implementation of web services. Below are 20 key concepts related to SOAP architecture, fully explained and with examples for each. At the end, I’ve also provided a list of pros and cons of the SOAP architecture.

1. XML-Based Messaging

Explanation:

SOAP messages are encapsulated in XML, providing a standardized structure for data exchange.

Example:

<Envelope>
  <Header>...</Header>
  <Body>...</Body>
</Envelope>

2. Request-Response Model

Explanation:

SOAP follows a request-response model where the client sends a request message and awaits a response from the server.

Example:

A SOAP request for weather information and the server responds with the weather data.

3. Remote Procedure Call (RPC)

Explanation:

SOAP allows clients to call methods available on the server as if they are local procedures.

Example:

A client invoking a GetPrice method on a server by sending an XML message describing the call.

4. Document Style

Explanation:

SOAP messages can include complex XML documents. In “Document” style, the SOAP body can contain any XML payload.

Example:

A SOAP message containing an XML invoice document.

5. Service Description

Explanation:

WSDL (Web Services Description Language) provides a machine-readable description of how the web service can be called.

Example:

WSDL document describing all the methods available in a weather web service.

6. Transport Protocol Agnostic

Explanation:

SOAP messages can be sent over various transport protocols.

Example:

SOAP over HTTP, SOAP over SMTP.

7. Headers

Explanation:

SOAP messages can include headers for adding features like authentication or transactions.

Example:

SOAP header for carrying authentication tokens.

8. Fault Handling

Explanation:

SOAP has a standardized mechanism for error reporting via SOAP Fault elements.

Example:

<Fault>
  <faultcode>...</faultcode>
  <faultstring>...</faultstring>
</Fault>

9. Namespaces

Explanation:

SOAP uses XML namespaces to uniquely identify elements and attributes.

Example:

<soap:Envelope> where soap is a namespace prefix.

10. SOAP Actions

Explanation:

SOAPAction HTTP header field indicates the intent of the SOAP request.

Example:

HTTP header with SOAPAction: "http://example.com/GetPrice"

11. Encapsulation

Explanation:

SOAP allows the encapsulation of complex structures and even binary data.

Example:

A SOAP message containing Base64-encoded binary data.

12. Attachments

Explanation:

SOAP can handle attachments using MTOM (Message Transmission Optimization Mechanism).

Example:

A SOAP message with an attached PDF file using MTOM.

13. Intermediaries

Explanation:

SOAP messages can be routed through multiple intermediary nodes.

Example:

A SOAP message passing through a logging server and an authentication server.

14. Data Types

Explanation:

SOAP uses XML Schema to define data types, providing strong typing.

Example:

A SOAP message specifying an integer parameter as xsd:int.

15. Versioning

Explanation:

SOAP is built to support versioning, allowing services to evolve over time.

Example:

SOAP 1.1 to SOAP 1.2 transition.

16. Security

Explanation:

SOAP provides comprehensive security features through WS-Security.

Example:

SOAP message with an encrypted payload using WS-Security.

17. Transactions

Explanation:

SOAP can provide transactional integrity via protocols like WS-AtomicTransaction.

Example:

A SOAP message initiating a multi-step, transactional operation.

18. Asynchrony

Explanation:

SOAP supports asynchronous operations through features like WS-ReliableMessaging.

Example:

Two SOAP messages in a conversation, one initiating a long-running process and another confirming its completion.

19. Session Management

Explanation:

SOAP can manage sessions by maintaining state between message exchanges.

Example:

SOAP headers containing session cookies.

20. Discoverability

Explanation:

SOAP services can be discovered dynamically using registries like UDDI.

Example:

Querying a UDDI registry to discover available SOAP-based services.


Pros and Cons of SOAP Architecture

Pros:

  • Strongly Typed: Schema ensures data format consistency.
  • Security Features: Advanced security through WS-Security.
  • Interoperable: Works across different platforms and languages.
  • Comprehensive: Supports features like transactions and messaging patterns.
  • Industry Adoption: Widely used in enterprise settings.

Cons:

  • Complexity: Steep learning curve due to multiple standards and specifications.
  • Verbose: SOAP messages can be bulky, affecting performance.
  • Rigidity: Strong typing and schemas can sometimes be limiting.
  • Overhead: Features like security and transactions can introduce overhead.

RELATED POSTS

View all

view all