SlideShare a Scribd company logo
1 of 11
SOAP vs. REST
SOAP to wash and REST to relax




           Antonio Loureiro Severien
                   FIB-UPC
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
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>
Simple Example
                                                    REQUEST
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
 <m:GetStockPrice>
  <m:StockName>IBM</m:StockName>
 </m:GetStockPrice>
</soap:Body>

</soap:Envelope>
Simple Example
                                                    RESPONSE
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
 <m:GetStockPriceResponse>
  <m:Price>34.5</m:Price>
 </m:GetStockPriceResponse>
</soap:Body>

</soap:Envelope>
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
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
Constraints and Principles
 Client-server
 Cacheable
 Stateless
 Uniform interface


 Identification of resources
 Manipulation of resources
 Self-descriptive messages
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
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
Reference
   http://www.w3schools.com/soap/default.asp
   http://en.wikipedia.org/wiki/Representational_State
    _Transfer
   http://en.wikipedia.org/wiki/SOAP
   http://www.crummy.com/writing/RESTful-Web-
    Services/
   http://tomayko.com/writings/rest-to-my-wife

More Related Content

What's hot (20)

An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
 
Introduction to REST - API
Introduction to REST - APIIntroduction to REST - API
Introduction to REST - API
 
Rest API
Rest APIRest API
Rest API
 
Restful web services ppt
Restful web services pptRestful web services ppt
Restful web services ppt
 
Soap Vs Rest
Soap Vs RestSoap Vs Rest
Soap Vs Rest
 
What is an API?
What is an API?What is an API?
What is an API?
 
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | EdurekaWhat is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
 
Simple object access protocol(soap )
Simple object access protocol(soap )Simple object access protocol(soap )
Simple object access protocol(soap )
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
 
SOAP-based Web Services
SOAP-based Web ServicesSOAP-based Web Services
SOAP-based Web Services
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
SOAP vs REST
SOAP vs RESTSOAP vs REST
SOAP vs REST
 
What is an API
What is an APIWhat is an API
What is an API
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
WSDL
WSDLWSDL
WSDL
 
C# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENTC# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENT
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
REST-API overview / concepts
REST-API overview / conceptsREST-API overview / concepts
REST-API overview / concepts
 

Similar to Soap vs rest

Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServicesAbdulImrankhan7
 
Java Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPJava Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPIMC Institute
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServicesKhasim Cise
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic OverviewRajkattamuri
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic OverviewKhan625
 
REST vs SOAP
REST vs SOAPREST vs SOAP
REST vs SOAPjavicid
 
Simple Object Access Protocol
Simple Object Access ProtocolSimple Object Access Protocol
Simple Object Access ProtocolSaatviga Sudhahar
 
Esri Web Applications February11 2011
Esri Web Applications February11 2011Esri Web Applications February11 2011
Esri Web Applications February11 2011delmelle
 
Web-Services!.pptx
Web-Services!.pptxWeb-Services!.pptx
Web-Services!.pptxssuserae0316
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web ServicesAngelin R
 
Intercloud interoperability
Intercloud interoperabilityIntercloud interoperability
Intercloud interoperabilitySam Johnston
 

Similar to Soap vs rest (20)

Soap.doc
Soap.docSoap.doc
Soap.doc
 
WebServices introduction
WebServices introductionWebServices introduction
WebServices introduction
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServices
 
Java Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPJava Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAP
 
Soap
SoapSoap
Soap
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServices
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic Overview
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic Overview
 
Mule Webservices
Mule WebservicesMule Webservices
Mule Webservices
 
Introduction to SOAP
Introduction to SOAPIntroduction to SOAP
Introduction to SOAP
 
REST vs SOAP
REST vs SOAPREST vs SOAP
REST vs SOAP
 
Simple Object Access Protocol
Simple Object Access ProtocolSimple Object Access Protocol
Simple Object Access Protocol
 
CSG 2012
CSG 2012CSG 2012
CSG 2012
 
SOAP Overview
SOAP OverviewSOAP Overview
SOAP Overview
 
Esri Web Applications February11 2011
Esri Web Applications February11 2011Esri Web Applications February11 2011
Esri Web Applications February11 2011
 
Soap xp-wg
Soap xp-wgSoap xp-wg
Soap xp-wg
 
Web-Services!.pptx
Web-Services!.pptxWeb-Services!.pptx
Web-Services!.pptx
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
Web Services
Web ServicesWeb Services
Web Services
 
Intercloud interoperability
Intercloud interoperabilityIntercloud interoperability
Intercloud interoperability
 

More from Antonio Severien

Scalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data StreamsScalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data StreamsAntonio Severien
 
Scalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data StreamsScalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data StreamsAntonio Severien
 
On Pragmatism and Scientific Freedom
On Pragmatism and Scientific FreedomOn Pragmatism and Scientific Freedom
On Pragmatism and Scientific FreedomAntonio Severien
 
Community cloud antonioseverien
Community cloud antonioseverienCommunity cloud antonioseverien
Community cloud antonioseverienAntonio Severien
 

More from Antonio Severien (6)

Scalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data StreamsScalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data Streams
 
Scalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data StreamsScalable Distributed Real-Time Clustering for Big Data Streams
Scalable Distributed Real-Time Clustering for Big Data Streams
 
NoSQL: Cassadra vs. HBase
NoSQL: Cassadra vs. HBaseNoSQL: Cassadra vs. HBase
NoSQL: Cassadra vs. HBase
 
On Pragmatism and Scientific Freedom
On Pragmatism and Scientific FreedomOn Pragmatism and Scientific Freedom
On Pragmatism and Scientific Freedom
 
Community cloud antonioseverien
Community cloud antonioseverienCommunity cloud antonioseverien
Community cloud antonioseverien
 
Relational Cloud
Relational CloudRelational Cloud
Relational Cloud
 

Recently uploaded

Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Recently uploaded (20)

Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

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>
  • 4. Simple Example REQUEST POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
  • 5. Simple Example RESPONSE HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </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
  • 11. Reference  http://www.w3schools.com/soap/default.asp  http://en.wikipedia.org/wiki/Representational_State _Transfer  http://en.wikipedia.org/wiki/SOAP  http://www.crummy.com/writing/RESTful-Web- Services/  http://tomayko.com/writings/rest-to-my-wife