SOAP is a protocol for exchanging structured information in a decentralized, distributed environment using XML. It uses RPC and HTTP. REST focuses on accessing named resources through a consistent interface and represents resource state. SOAP is better for enterprise security and transactions while REST is lighter weight and less complex, using standard HTTP and supporting JSON. The choice depends on needs - SOAP for banking apps, REST for simpler web services.
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Â
Soap vs rest
1. SOAP vs. REST
SOAP to wash and REST to relax
Antonio Loureiro Severien
FIB-UPC
2. What is SOAP?
ď‚— SOAP: Simple Object Access Protocol
is a protocol for exchange of
structured information on a
decentralized and distributed platform
using XML (eXtensible Markup
Language)
ď‚— Works mainly with RPC (Remote
Procedure Call) and HTTP (HyperText
Transfer Protocol)
ď‚— HTTP makes SOAP go around
3. SOAP structure
ď‚— 3 parts message: Envelope, Header,
Body
POST /InStock HTTP/1.1
ENVELOPE Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8 HTT
HEADER Content-Length: 299
SOAPAction: "http://www.w3.org/2003/05/soap-envelope"
P
<?xml version="1.0"?>
<soap:Envelope
BODY
xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetStockPrice xmlns:m="http://www.example.org/stock">
FAULT <m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
6. SOAP Characteristics, Pros and
Cons
ď‚— Implements its own protocol
ď‚— Exposes pieces of application logic,
operations
ď‚— Advantages
â—¦ Versatile in use of different application
protocols
â—¦ Tunnels easily through firewalls due to the
use of HTTP model
ď‚— Disadvantages
â—¦ Slower when using large XML messages
7. What is REST?
ď‚— REST: Representational State
Transfer focuses on accessing named
resources through a consistent
interface
ď‚— Every resource has its representation
(could be a document) and the
resource state changes when some
method is applied through a request
using any vocabulary
8. Constraints and Principles
ď‚— Client-server
ď‚— Cacheable
ď‚— Stateless
ď‚— Uniform interface
ď‚— Identification of resources
ď‚— Manipulation of resources
ď‚— Self-descriptive messages
9. SOAP vs. REST
ď‚— SOAP RPC: Application designers have
to build up their protocol vocabulary
whereas in REST it uses the well known
vocabulary of the protocol in use
ď‚— REST: Different data formats where
SOAP only allows XML
ď‚— REST has support for JSON, uses
standard HTTP
ď‚— REST better performance and scalability
ď‚— SOAP reads cannot be cached
10. When to wash? When to
relax?
ď‚— SOAP
â—¦ WS-Security: enterprise security features
â—¦ WS-AtomicTransactions: ACID compliant
â—¦ WS-ReliableMessaging: end-to-end reliability
â—¦ Ex.: smartphone app that communicates with
a bank app on the web, need the previous
implementations
ď‚— REST
â—¦ Lightweight
â—¦ Less complex for maintenance
◦ Bring the “web” back to web services