LearnThatStack Ace your next interview
API Design · question
Question 22 of 110

What is the difference between REST and SOAP?

beginner
← All API Design questions
Re-explain

SOAP is a protocol with a fixed XML message format, while REST is an architectural style. SOAP wraps every call in an XML envelope, and a SOAP service usually publishes a WSDL contract. REST APIs expose resources at URLs and act on them with standard HTTP methods, usually exchanging JSON.

SOAP REST
Kind Protocol Architectural style
Format XML only Any format, usually JSON
Contract Usually a WSDL Optional, often OpenAPI
Transport HTTP, SMTP and others Usually HTTP
Caching Rare, since calls are usually POST Standard HTTP caching
Security WS-Security at the message level TLS plus tokens such as OAuth

Choose REST for most web and mobile APIs, where lighter payloads and HTTP caching matter. SOAP still fits enterprise systems that need a formal contract or message-level security, such as older banking and insurance integrations.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for API Design One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

  • You called REST an architectural style. What constraints make an API RESTful? Name them: client-server, stateless, cacheable, uniform interface, layered system, plus optional code on demand.
  • Why is HTTP caching common with REST but rare with SOAP? SOAP calls are usually POSTs to one endpoint, which HTTP caches skip. REST GETs on resource URLs can use Cache-Control and ETags.
  • What does WS-Security give you that TLS alone does not? TLS protects one connection. Message-level signing and encryption stay with the message through intermediaries and can cover parts of it.
  • When would you pick gRPC over both REST and SOAP? Internal service-to-service calls that need low latency or streaming, with Protobuf contracts and generated clients. Browsers need gRPC-Web.
  • Your new REST service must call a legacy SOAP system. How do you integrate them? Wrap the SOAP calls in an adapter that uses a client generated from the WSDL, and map SOAP faults to your own HTTP errors.

What you can say

  1. The core difference is that SOAP is a protocol with a fixed XML message format, while REST is an architectural style, usually applied over HTTP.
  2. With SOAP, every call is wrapped in an XML envelope, and the service usually publishes a WSDL contract that describes its operations.
  3. With REST, you expose resources at URLs and act on them with standard HTTP methods like GET and POST, usually exchanging JSON.
  4. That shows up in caching. SOAP calls are usually POSTs, so they rarely get cached, while REST reads can use normal HTTP caching.
  5. Security differs too. SOAP has WS-Security at the message level, and REST usually relies on TLS plus tokens such as OAuth.
  6. So I'd choose REST for most web and mobile APIs. SOAP still fits enterprise integrations, like older banking systems, that need a formal contract or message-level security.

Weak answers to avoid

  • Calls REST a protocol REST is an architectural style and SOAP is the protocol. Interviewers catch this mix-up first. Say REST usually runs over HTTP but is not HTTP itself.
  • Says SOAP is dead or always worse SOAP still runs many banking and insurance integrations. Say when it fits, which is when you need a formal WSDL contract or message-level security.
  • Says REST means JSON REST allows any format, and JSON is just the common choice. The real difference is resources at URLs with HTTP methods versus XML envelopes.
  • Recites a feature table with no trade-off A list of format and transport differences sounds memorized. Tie it to a choice: HTTP caching and light payloads for REST, a strict contract for SOAP.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the API Design cheatsheet.

← Back to all API Design questions
Pro · $10/mo

90 of 110 API Design answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime