Skip to content
SEE Exam Prep

Question 9 of 15 · CIE-2 QB · Set 1 · 6 marks

Open in ChatGPT

Explain about SOAP and REST with respect to communication mechanisms, message formats, interface definitions, and protocol requirements.


Introduction

SOAP and REST are the two ways web services have been built. SOAP is a protocol with a fixed message format; REST is a style that uses HTTP itself as the interface.

SOAP

  • Communication: a request is an XML document posted to one endpoint; the server replies with an XML document. Everything is a POST, whatever the operation.
  • Message format: an envelope with a Header (security, routing, transactions) and a Body (the payload), defined by XML Schema.
  • Interface definition: a WSDL file describes every operation, message and binding, so a client can be generated mechanically.
  • Protocol requirements: transport-independent in principle (HTTP, SMTP, JMS), with WS-Security, WS-ReliableMessaging and WS-AtomicTransaction layered on top.

REST

  • Communication: a resource is a URI, and the HTTP method is the verb: GET /students/152, DELETE /students/152.
  • Message format: whatever the representation is, usually JSON, sometimes XML; the client asks with Accept.
  • Interface definition: none required; hypermedia links or an OpenAPI document describe it informally.
  • Protocol requirements: HTTP semantics: statelessness, cacheability, status codes, idempotency of GET and PUT.

Comparison

Point SOAP REST
Style Protocol, RPC-like Architectural style, resource-like
Payload XML envelope JSON usually, any media type
Contract WSDL, machine-checkable OpenAPI or none
Caching Hard, one POST endpoint Native, GET is cacheable
Security WS-Security, message-level TLS, token headers
Best for Enterprise contracts, transactions Public APIs, mobile clients

Conclusion

SOAP carries its own standards for security and transactions, which enterprises needed; REST reuses HTTP so heavily that caching, proxies and browser debugging come free. New public APIs are REST or gRPC, and SOAP survives where the contract and WS-* standards are contractual obligations.