SlideShare a Scribd company logo
RESTful
Webservices
Mohammed Luqman Shareef
Agenda
• Introduction to Webservices
• SOAP based webservices
• RESTful webservices
• Implementation of RESTful webservices
• SOAP vs. REST
• Why SOAP?
• Why REST?
• Q&A
9/29/2013www.luqmanshareef.com
2
What is a webservice?
• There are too many definitions.
• Most of them are very specific to SOAP based services, and consider
WSDL and UDDI as its integral parts, like
▫ “Web service is a standard way of integrating Web-based applications
using the XML, SOAP, WSDL and UDDI open standards over an Internet
protocol backbone. ”
• There are too generic definitions as well, like
▫ “Web services are loosely coupled computing services that can reduce
the complexity of building business applications, save costs, and enable
new business models. Services running on an arbitrary machine can be
accessed in a platform- and language-independent fashion.”
▫ “Web Services can convert your applications into Web-applications.
Web Services are published, found, and used through the Web.”
9/29/2013www.luqmanshareef.com
3
XML (eXtensible Markup Language)
A uniform data representation and exchange
mechanism
SOAP (Simple Object Access Protocol)
Lightweight (XML-based) protocol for exchange
of information in a decentralized, distributed
environment
WSDL (Web Service Description Language)
XML format that describes the web service
UDDI (Universal Description Discovery and Integration)
Like yellow pages of Web services
2010-02-08www.luqmanshareef.com
4
Components of a SOAP based web service
Lets take a scenario
• An inventory database of a Supply chain management system
gets updated with products’ information from various
vendors.
• What is the best way to communicate?
▫ Each Vendor exposes a webservice (say SOAP based).
▫ Each webservice has its own contract(WSDL) defined, consisting
of various operations, input and output message types, bindings
etc.
▫ The consumer application needs to understand the contracts,
create a client stub to communicate with each vendor. For every
new vendor a separate stub is needed.
9/29/2013www.luqmanshareef.com
5
SOAP based webservice
• Each Vendor shall expose a webservice through an end point like
http://www.vendorX.com/the-endpoint
▫ Operations can be:
 GetProduct
 AddProduct
 DeleteProduct
• For Example GetProduct message will look like
9/29/2013www.luqmanshareef.com
6
HTTP Header
SOAP Envelope
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
<env:Body>
<v:GetProduct xmlns:v="http://vendorX.com/">
<v:ProdId>X123</v:ProdId>
<v:Name>Hard Drive</v:Name>
</v:GetProduct>
</env:Body>
</env:Envelope>
SOAP based webservice
• Whether it is a pull operation or a push, (i.e., request for
the product info, or add a new product) it is simply a
get/post. And the content shared is always the product
information in a standard format.
• Why do we need different contracts from different
vendors?
• Can’t we use any of the standards prevailing in the
industry to make life easier?
• Why not a simple GET operation be done with HTTP
GET method?
9/29/2013www.luqmanshareef.com
7
HTTP Protocol
• Lets use standard HTTP protocol.
• It can be accessed via a URL (Uniform Resource Locator) like
▫ http://www.vendorx.com/products/x123
• It has standard methods to
▫ Retrieve ( GET )
▫ Create ( POST )
▫ Update ( PUT )
▫ Delete (DELETE )
• Payload can be directly added to http message. No need to
wrap it in another protocol.
9/29/2013www.luqmanshareef.com
8
RESTful web services
• It is a simple stateless architecture that generally runs over HTTP.
• The focus is on a resource in the system
▫ Ex: an Employee, an Account, a Product etc.
• Each unique URL is a representation of some object
Ex : http://www.vendorx.com/products
http://www.vendorx.com/products/x123
• HTTP methods (GET/POST/…) operates on the resource.
• Object state is transferred and stored at client.
• Representation of the resource state in XML, JSON etc.
9/29/2013www.luqmanshareef.com
REpresentational State Transfer
9
RPC vs REST
• Every object has its own unique methods
• Methods can be remotely invoked over the Internet
• A single URI represents the end-point, and that's the
only contract with the Web
• Data hidden behind method calls and parameters
• Data is unavailable to Web applications
9/29/2013www.luqmanshareef.com
 Every useful data object has an address
 Resources themselves are the targets for
method calls
 The list of methods is fixed for all resources
RPC
REST
10
RESTful web services contd…
9/29/2013www.luqmanshareef.com
Client side
> Easy to experiment in browser
> Broad programming language support
> Choice of data formats
> bookmarkable
Server side
> Uniform Interface
> Cacheable
> Scalable
> Easy failover
Benefits
> Resource identification through URI
> Uniform interface
GET/PUT/POST/DELETE
> Self-descriptive messages
> Stateless interactions through hyperlinks
Principles
11
Six characteristics of REST:
• Uniform interface
• Decoupled client-server interaction
• Stateless
• Cacheable
• Layered
• Extensible through code on demand (optional)
* Services that do not conform to the above required contstraints are not strictly
RESTful web services.
9/29/2013www.luqmanshareef.com
12
Product service as RESTful
9/29/2013
www.luqmanshareef.com
Request
GET /products/X123 HTTP/1.1
Host: vendorx.com
Accept: application/xml
Response
HTTP/1.1 200 OK
Date: Tue, 09 Feb 2010 11:41:20 GMT
Server: Apache/1.3.6
Content-Type: application/xml; charset=UTF-8
<?xml version="1.0"?>
<Products xmlns="…">
<Product id=“X123”>
…
</Product>
</Products>
Method Resource
Representation
State
transfer
13
Developing a RESTful web service
using JAX-RS
9/29/2013www.luqmanshareef.com
package com.vendorx.products;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.Path;
@Path("/employees/{pid}")
public class Product{
@GET
@Produces("text/xml")
public String getProduct(@PathParam(“pid") String pId) {
...
…
}
}
14
JAX-RS REST Annotations
Annotation Description
@Path
The @Path annotation's value is a relative URI path indicating where the Java class will be hosted, for
example, /helloworld. You can also embed variables in the URIs to make a URI path template. For
example, you could ask for the name of a user, and pass it to the application as a variable in the URI, like
this, /helloworld/{username}.
@GET The @GET annotation is a request method designator and corresponds to the similarly named HTTP
method. The Java method annotated with this request method designator will process HTTP GET
requests. The behavior of a resource is determined by the HTTP method to which the resource is
responding.
@POST The @POST annotation is a request method designator and corresponds to the similarly named HTTP
method. The Java method annotated with this request method designator will process HTTP POST
requests. The behavior of a resource is determined by the HTTP method to which the resource is
responding.
@PUT The @PUT annotation is a request method designator and corresponds to the similarly named HTTP
method. The Java method annotated with this request method designator will process HTTP PUT requests.
The behavior of a resource is determined by the HTTP method to which the resource is responding.
@DELETE The @DELETE annotation is a request method designator and corresponds to the similarly named HTTP
method. The Java method annotated with this request method designator will process HTTPDELETE
requests. The behavior of a resource is determined by the HTTP method to which the resource is
responding.
9/29/2013www.luqmanshareef.com
15
JAX-RS REST Annotations
Annotation Description
@HEAD
The @HEAD annotation is a request method designator and corresponds to the similarly named
HTTP method. The Java method annotated with this request method designator will process HTTP
HEAD requests. The behavior of a resource is determined by the HTTP method to which the
resource is responding.
@PathParam
The @PathParam annotation is a type of parameter that you can extract for use in your resource
class. URI path parameters are extracted from the request URI, and the parameter names
correspond to the URI path template variable names specified in the @Path class-level annotation.
@QueryParam The @QueryParam annotation is a type of parameter that you can extract for use in your resource
class. Query parameters are extracted from the request URI query parameters.
@Consumes The @Consumes annotation is used to specify the MIME media types of representations a resource
can consume that were sent by the client.
@Produces The @Produces annotation is used to specify the MIME media types of representations a resource
can produce and send back to the client, for example, "text/plain".
9/29/2013www.luqmanshareef.com
16
Using Spring framework
9/29/2013www.luqmanshareef.com
17
Arguments: SOAP vs. REST
• SOAP based webservices are too complex for a
web based service.
• How about transactions and reliability in REST?
• SOAP based webservices are protocol
independent.
• REST operations are limited (only http methods)
• SOAP has built-in error handling.
• REST is easy to test (in any browser)
• SOAP is not only for Web.
• REST development is faster and easier.
9/29/2013www.luqmanshareef.com
18
Arguments: SOAP vs. REST
• REST has better performance and scalability.
• SOAP has many extensions built WS-* (security,
transaction etc.)
• A service offered in a REST style will be easier to
consume than some complex API:
▫ Lower learning curve for the consumer
▫ Lower support overhead for the producer
• What happens when you need application semantics that
don't fit into the GET / PUT / POST / DELETE generic
interfaces and representational state model?
• These interfaces are sufficiently general. Other interfaces
considered harmful because they increase the costs of
consuming particular services
9/29/2013www.luqmanshareef.com
19
Why REST?
• Exposing a public API over the internet to handle CRUD operations on data.
• REST permits many different formats like XML, JSON etc.
• REST reads can be cached.
• REST is concise. No need of additional messaging layer.
• REST is stateless. If an operation needs to be continued just REST doesn’t help.
• Easy to test (in any browser, no need of a new client to write)
• REST is particularly useful for restricted-profile devices such as mobile and PDAs for
which the overhead of additional parameters like headers and other SOAP elements
are less.
9/29/2013www.luqmanshareef.com
20
Why SOAP?
• SOAP is not only for Web. It has its own protocol.
• SOAP Exposes application logic (not data) as service. Exposes named operations.
• Can implement stateful web services.
• SOAP Web services are useful in handling asynchronous processing and invocation.
• SOAP has additional feature built on top of it which REST doesn’t.
▫ WS-Security
▫ WS-Reliable Messaging
▫ WS-Atomic Transactions
• Most real-world applications are not simple and support complex operations, which
require conversational state and contextual information to be maintained. With the SOAP
approach, developers need not worry about writing this plumbing code into the application
layer themselves.
9/29/2013www.luqmanshareef.com
21
WSDL 2.0
• WSDL 2.0 is tailored for SOAP-based Web services
• However, HTTP binding in WSDL 2.0 allows for good description of HTTP services
▫ <binding name="HttpBinding" interface="m:GetTemperature"
type="http://www.w3.org/2005/08/wsdl/http">
<operation ref="m:location" whttp:method="GET"
whttp:location="{country}/{city}"/>
</binding>
• It allows for an HTTP GET on http://weather.example/country/city:
▫ HTTP/1.1 200 Here's the temperature for you
Content-Type: application/xml
…
<weather xmlns="…">
<temperature>23</temperature>
</weather>
• All HTTP methods are supported.
9/29/2013www.luqmanshareef.com
22
2010-02-08www.luqmanshareef.com
23
Questions?
2010-02-08www.luqmanshareef.com
24
Ad

More Related Content

What's hot (20)

SOAP-based Web Services
SOAP-based Web ServicesSOAP-based Web Services
SOAP-based Web Services
Katrien Verbert
 
Implementation advantages of rest
Implementation advantages of restImplementation advantages of rest
Implementation advantages of rest
Balamurugan Easwaran
 
Rest web services
Rest web servicesRest web services
Rest web services
Paulo Gandra de Sousa
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical Approach
Madhaiyan Muthu
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
Hoan Vu Tran
 
REST API Design
REST API DesignREST API Design
REST API Design
Devi Kiran G
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
srividhyau
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
Doing REST Right
Doing REST RightDoing REST Right
Doing REST Right
Kerry Buckley
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
Pankaj Bajaj
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)
Jef Claes
 
Designing REST services with Spring MVC
Designing REST services with Spring MVCDesigning REST services with Spring MVC
Designing REST services with Spring MVC
Serhii Kartashov
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
Jeelani Shaik
 
Excellent rest using asp.net web api
Excellent rest using asp.net web apiExcellent rest using asp.net web api
Excellent rest using asp.net web api
Maurice De Beijer [MVP]
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
Compare Infobase Limited
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
Inviqa
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
Ido Flatow
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical Approach
Madhaiyan Muthu
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
Hoan Vu Tran
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
srividhyau
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
Pankaj Bajaj
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)
Jef Claes
 
Designing REST services with Spring MVC
Designing REST services with Spring MVCDesigning REST services with Spring MVC
Designing REST services with Spring MVC
Serhii Kartashov
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
Jeelani Shaik
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
Inviqa
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
Ido Flatow
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 

Viewers also liked (20)

Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservices
Mohammed A. Imran
 
Fnul selling techniques and handling objection
Fnul selling techniques and handling objectionFnul selling techniques and handling objection
Fnul selling techniques and handling objection
Pik Lertsavetpong
 
Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...
Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...
Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...
Luca Spoldi
 
Treb Market Watch August 2010
Treb Market Watch August 2010Treb Market Watch August 2010
Treb Market Watch August 2010
James Metcalfe
 
Social Monitor keynote - Barcelona Affiliate Conference #BAC2014
Social Monitor keynote - Barcelona Affiliate Conference #BAC2014Social Monitor keynote - Barcelona Affiliate Conference #BAC2014
Social Monitor keynote - Barcelona Affiliate Conference #BAC2014
Joakim Nilsson
 
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Mamadigital
 
Caruso Inq Project
Caruso Inq ProjectCaruso Inq Project
Caruso Inq Project
kalmanidisn1
 
MedicinMan vol1 Issue 4; November 2011
MedicinMan vol1 Issue 4; November 2011MedicinMan vol1 Issue 4; November 2011
MedicinMan vol1 Issue 4; November 2011
Anup Soans
 
Week13 - Group Presentation Slide
Week13 - Group Presentation SlideWeek13 - Group Presentation Slide
Week13 - Group Presentation Slide
tykl94
 
การปรับปร..
การปรับปร..การปรับปร..
การปรับปร..
guestd6bdc29e4
 
Pharma Field Sales Learning and Development
Pharma Field Sales Learning and DevelopmentPharma Field Sales Learning and Development
Pharma Field Sales Learning and Development
Anup Soans
 
Ccm Smim2l
Ccm Smim2lCcm Smim2l
Ccm Smim2l
MIMCCMS
 
Pegasus essentials 2012 2013
Pegasus essentials 2012 2013Pegasus essentials 2012 2013
Pegasus essentials 2012 2013
Jennifer Marten
 
MedicinMan October 2012
MedicinMan  October 2012MedicinMan  October 2012
MedicinMan October 2012
Anup Soans
 
Tarea
TareaTarea
Tarea
garrapateira
 
Data Science in Cardiac Sciences
Data Science in Cardiac SciencesData Science in Cardiac Sciences
Data Science in Cardiac Sciences
Robert Chen
 
Camus, Albert Ciuma Uc
Camus, Albert   Ciuma UcCamus, Albert   Ciuma Uc
Camus, Albert Ciuma Uc
ruoy
 
Sales Management
Sales ManagementSales Management
Sales Management
Mohamed El-Hiti
 
2009 Elvis Presley 50s Movie Collection
2009   Elvis Presley   50s Movie Collection2009   Elvis Presley   50s Movie Collection
2009 Elvis Presley 50s Movie Collection
Elvis Presley Blues
 
四驱赛车
四驱赛车四驱赛车
四驱赛车
zust
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservices
Mohammed A. Imran
 
Fnul selling techniques and handling objection
Fnul selling techniques and handling objectionFnul selling techniques and handling objection
Fnul selling techniques and handling objection
Pik Lertsavetpong
 
Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...
Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...
Sentieri Digitali 2010 - La comunicazione nell'era delle realtà virtuali (by ...
Luca Spoldi
 
Treb Market Watch August 2010
Treb Market Watch August 2010Treb Market Watch August 2010
Treb Market Watch August 2010
James Metcalfe
 
Social Monitor keynote - Barcelona Affiliate Conference #BAC2014
Social Monitor keynote - Barcelona Affiliate Conference #BAC2014Social Monitor keynote - Barcelona Affiliate Conference #BAC2014
Social Monitor keynote - Barcelona Affiliate Conference #BAC2014
Joakim Nilsson
 
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Mamadigital
 
Caruso Inq Project
Caruso Inq ProjectCaruso Inq Project
Caruso Inq Project
kalmanidisn1
 
MedicinMan vol1 Issue 4; November 2011
MedicinMan vol1 Issue 4; November 2011MedicinMan vol1 Issue 4; November 2011
MedicinMan vol1 Issue 4; November 2011
Anup Soans
 
Week13 - Group Presentation Slide
Week13 - Group Presentation SlideWeek13 - Group Presentation Slide
Week13 - Group Presentation Slide
tykl94
 
การปรับปร..
การปรับปร..การปรับปร..
การปรับปร..
guestd6bdc29e4
 
Pharma Field Sales Learning and Development
Pharma Field Sales Learning and DevelopmentPharma Field Sales Learning and Development
Pharma Field Sales Learning and Development
Anup Soans
 
Ccm Smim2l
Ccm Smim2lCcm Smim2l
Ccm Smim2l
MIMCCMS
 
Pegasus essentials 2012 2013
Pegasus essentials 2012 2013Pegasus essentials 2012 2013
Pegasus essentials 2012 2013
Jennifer Marten
 
MedicinMan October 2012
MedicinMan  October 2012MedicinMan  October 2012
MedicinMan October 2012
Anup Soans
 
Data Science in Cardiac Sciences
Data Science in Cardiac SciencesData Science in Cardiac Sciences
Data Science in Cardiac Sciences
Robert Chen
 
Camus, Albert Ciuma Uc
Camus, Albert   Ciuma UcCamus, Albert   Ciuma Uc
Camus, Albert Ciuma Uc
ruoy
 
2009 Elvis Presley 50s Movie Collection
2009   Elvis Presley   50s Movie Collection2009   Elvis Presley   50s Movie Collection
2009 Elvis Presley 50s Movie Collection
Elvis Presley Blues
 
四驱赛车
四驱赛车四驱赛车
四驱赛车
zust
 
Ad

Similar to Restful webservices (20)

REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
Halil Burak Cetinkaya
 
Overview of java web services
Overview of java web servicesOverview of java web services
Overview of java web services
Todd Benson (I.T. SPECIALIST and I.T. SECURITY)
 
Restful web services
Restful web servicesRestful web services
Restful web services
MD Sayem Ahmed
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and Lies
Paul Fremantle
 
Mini-Training: Let's have a rest
Mini-Training: Let's have a restMini-Training: Let's have a rest
Mini-Training: Let's have a rest
Betclic Everest Group Tech Team
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
A web server is a software application or hardware device that stores, proces...
A web server is a software application or hardware device that stores, proces...A web server is a software application or hardware device that stores, proces...
A web server is a software application or hardware device that stores, proces...
Manonmani40
 
Wt unit 6 ppts web services
Wt unit 6 ppts web servicesWt unit 6 ppts web services
Wt unit 6 ppts web services
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdf
Aparna Sharma
 
REST Introduction.ppt
REST Introduction.pptREST Introduction.ppt
REST Introduction.ppt
KGSCSEPSGCT
 
Application_layer.pdf
Application_layer.pdfApplication_layer.pdf
Application_layer.pdf
BhoomikaPrajapath
 
Web service architecture
Web service architectureWeb service architecture
Web service architecture
Muhammad Shahroz Anwar
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
rporwal
 
Web technology-guide
Web technology-guideWeb technology-guide
Web technology-guide
Srihari
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open Interfaces
Steve Speicher
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
Madhukar Kumar
 
Microservices
MicroservicesMicroservices
Microservices
Karol Grzegorczyk
 
zendframework2 restful
zendframework2 restfulzendframework2 restful
zendframework2 restful
tom_li
 
Ch-1_.ppt
Ch-1_.pptCh-1_.ppt
Ch-1_.ppt
berihunmolla2
 
webservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.pptwebservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.ppt
Matrix823409
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and Lies
Paul Fremantle
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
A web server is a software application or hardware device that stores, proces...
A web server is a software application or hardware device that stores, proces...A web server is a software application or hardware device that stores, proces...
A web server is a software application or hardware device that stores, proces...
Manonmani40
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdf
Aparna Sharma
 
REST Introduction.ppt
REST Introduction.pptREST Introduction.ppt
REST Introduction.ppt
KGSCSEPSGCT
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
rporwal
 
Web technology-guide
Web technology-guideWeb technology-guide
Web technology-guide
Srihari
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open Interfaces
Steve Speicher
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
Madhukar Kumar
 
zendframework2 restful
zendframework2 restfulzendframework2 restful
zendframework2 restful
tom_li
 
webservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.pptwebservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.ppt
Matrix823409
 
Ad

More from Luqman Shareef (10)

Containers virtaulization and docker
Containers virtaulization and dockerContainers virtaulization and docker
Containers virtaulization and docker
Luqman Shareef
 
Scrum luqman
Scrum luqmanScrum luqman
Scrum luqman
Luqman Shareef
 
Cloud computing by Luqman
Cloud computing by LuqmanCloud computing by Luqman
Cloud computing by Luqman
Luqman Shareef
 
Tech Days 2010
Tech  Days 2010Tech  Days 2010
Tech Days 2010
Luqman Shareef
 
Ajax
AjaxAjax
Ajax
Luqman Shareef
 
Service Oriented Architecture Luqman
Service Oriented Architecture LuqmanService Oriented Architecture Luqman
Service Oriented Architecture Luqman
Luqman Shareef
 
Xml by Luqman
Xml by LuqmanXml by Luqman
Xml by Luqman
Luqman Shareef
 
Web Service Security
Web Service SecurityWeb Service Security
Web Service Security
Luqman Shareef
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
Luqman Shareef
 
J2SE 5
J2SE 5J2SE 5
J2SE 5
Luqman Shareef
 

Recently uploaded (20)

tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 

Restful webservices

  • 2. Agenda • Introduction to Webservices • SOAP based webservices • RESTful webservices • Implementation of RESTful webservices • SOAP vs. REST • Why SOAP? • Why REST? • Q&A 9/29/2013www.luqmanshareef.com 2
  • 3. What is a webservice? • There are too many definitions. • Most of them are very specific to SOAP based services, and consider WSDL and UDDI as its integral parts, like ▫ “Web service is a standard way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. ” • There are too generic definitions as well, like ▫ “Web services are loosely coupled computing services that can reduce the complexity of building business applications, save costs, and enable new business models. Services running on an arbitrary machine can be accessed in a platform- and language-independent fashion.” ▫ “Web Services can convert your applications into Web-applications. Web Services are published, found, and used through the Web.” 9/29/2013www.luqmanshareef.com 3
  • 4. XML (eXtensible Markup Language) A uniform data representation and exchange mechanism SOAP (Simple Object Access Protocol) Lightweight (XML-based) protocol for exchange of information in a decentralized, distributed environment WSDL (Web Service Description Language) XML format that describes the web service UDDI (Universal Description Discovery and Integration) Like yellow pages of Web services 2010-02-08www.luqmanshareef.com 4 Components of a SOAP based web service
  • 5. Lets take a scenario • An inventory database of a Supply chain management system gets updated with products’ information from various vendors. • What is the best way to communicate? ▫ Each Vendor exposes a webservice (say SOAP based). ▫ Each webservice has its own contract(WSDL) defined, consisting of various operations, input and output message types, bindings etc. ▫ The consumer application needs to understand the contracts, create a client stub to communicate with each vendor. For every new vendor a separate stub is needed. 9/29/2013www.luqmanshareef.com 5
  • 6. SOAP based webservice • Each Vendor shall expose a webservice through an end point like http://www.vendorX.com/the-endpoint ▫ Operations can be:  GetProduct  AddProduct  DeleteProduct • For Example GetProduct message will look like 9/29/2013www.luqmanshareef.com 6 HTTP Header SOAP Envelope <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope"> <env:Body> <v:GetProduct xmlns:v="http://vendorX.com/"> <v:ProdId>X123</v:ProdId> <v:Name>Hard Drive</v:Name> </v:GetProduct> </env:Body> </env:Envelope>
  • 7. SOAP based webservice • Whether it is a pull operation or a push, (i.e., request for the product info, or add a new product) it is simply a get/post. And the content shared is always the product information in a standard format. • Why do we need different contracts from different vendors? • Can’t we use any of the standards prevailing in the industry to make life easier? • Why not a simple GET operation be done with HTTP GET method? 9/29/2013www.luqmanshareef.com 7
  • 8. HTTP Protocol • Lets use standard HTTP protocol. • It can be accessed via a URL (Uniform Resource Locator) like ▫ http://www.vendorx.com/products/x123 • It has standard methods to ▫ Retrieve ( GET ) ▫ Create ( POST ) ▫ Update ( PUT ) ▫ Delete (DELETE ) • Payload can be directly added to http message. No need to wrap it in another protocol. 9/29/2013www.luqmanshareef.com 8
  • 9. RESTful web services • It is a simple stateless architecture that generally runs over HTTP. • The focus is on a resource in the system ▫ Ex: an Employee, an Account, a Product etc. • Each unique URL is a representation of some object Ex : http://www.vendorx.com/products http://www.vendorx.com/products/x123 • HTTP methods (GET/POST/…) operates on the resource. • Object state is transferred and stored at client. • Representation of the resource state in XML, JSON etc. 9/29/2013www.luqmanshareef.com REpresentational State Transfer 9
  • 10. RPC vs REST • Every object has its own unique methods • Methods can be remotely invoked over the Internet • A single URI represents the end-point, and that's the only contract with the Web • Data hidden behind method calls and parameters • Data is unavailable to Web applications 9/29/2013www.luqmanshareef.com  Every useful data object has an address  Resources themselves are the targets for method calls  The list of methods is fixed for all resources RPC REST 10
  • 11. RESTful web services contd… 9/29/2013www.luqmanshareef.com Client side > Easy to experiment in browser > Broad programming language support > Choice of data formats > bookmarkable Server side > Uniform Interface > Cacheable > Scalable > Easy failover Benefits > Resource identification through URI > Uniform interface GET/PUT/POST/DELETE > Self-descriptive messages > Stateless interactions through hyperlinks Principles 11
  • 12. Six characteristics of REST: • Uniform interface • Decoupled client-server interaction • Stateless • Cacheable • Layered • Extensible through code on demand (optional) * Services that do not conform to the above required contstraints are not strictly RESTful web services. 9/29/2013www.luqmanshareef.com 12
  • 13. Product service as RESTful 9/29/2013 www.luqmanshareef.com Request GET /products/X123 HTTP/1.1 Host: vendorx.com Accept: application/xml Response HTTP/1.1 200 OK Date: Tue, 09 Feb 2010 11:41:20 GMT Server: Apache/1.3.6 Content-Type: application/xml; charset=UTF-8 <?xml version="1.0"?> <Products xmlns="…"> <Product id=“X123”> … </Product> </Products> Method Resource Representation State transfer 13
  • 14. Developing a RESTful web service using JAX-RS 9/29/2013www.luqmanshareef.com package com.vendorx.products; import javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.ws.rs.Path; @Path("/employees/{pid}") public class Product{ @GET @Produces("text/xml") public String getProduct(@PathParam(“pid") String pId) { ... … } } 14
  • 15. JAX-RS REST Annotations Annotation Description @Path The @Path annotation's value is a relative URI path indicating where the Java class will be hosted, for example, /helloworld. You can also embed variables in the URIs to make a URI path template. For example, you could ask for the name of a user, and pass it to the application as a variable in the URI, like this, /helloworld/{username}. @GET The @GET annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP GET requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. @POST The @POST annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP POST requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. @PUT The @PUT annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP PUT requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. @DELETE The @DELETE annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTPDELETE requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. 9/29/2013www.luqmanshareef.com 15
  • 16. JAX-RS REST Annotations Annotation Description @HEAD The @HEAD annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP HEAD requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. @PathParam The @PathParam annotation is a type of parameter that you can extract for use in your resource class. URI path parameters are extracted from the request URI, and the parameter names correspond to the URI path template variable names specified in the @Path class-level annotation. @QueryParam The @QueryParam annotation is a type of parameter that you can extract for use in your resource class. Query parameters are extracted from the request URI query parameters. @Consumes The @Consumes annotation is used to specify the MIME media types of representations a resource can consume that were sent by the client. @Produces The @Produces annotation is used to specify the MIME media types of representations a resource can produce and send back to the client, for example, "text/plain". 9/29/2013www.luqmanshareef.com 16
  • 18. Arguments: SOAP vs. REST • SOAP based webservices are too complex for a web based service. • How about transactions and reliability in REST? • SOAP based webservices are protocol independent. • REST operations are limited (only http methods) • SOAP has built-in error handling. • REST is easy to test (in any browser) • SOAP is not only for Web. • REST development is faster and easier. 9/29/2013www.luqmanshareef.com 18
  • 19. Arguments: SOAP vs. REST • REST has better performance and scalability. • SOAP has many extensions built WS-* (security, transaction etc.) • A service offered in a REST style will be easier to consume than some complex API: ▫ Lower learning curve for the consumer ▫ Lower support overhead for the producer • What happens when you need application semantics that don't fit into the GET / PUT / POST / DELETE generic interfaces and representational state model? • These interfaces are sufficiently general. Other interfaces considered harmful because they increase the costs of consuming particular services 9/29/2013www.luqmanshareef.com 19
  • 20. Why REST? • Exposing a public API over the internet to handle CRUD operations on data. • REST permits many different formats like XML, JSON etc. • REST reads can be cached. • REST is concise. No need of additional messaging layer. • REST is stateless. If an operation needs to be continued just REST doesn’t help. • Easy to test (in any browser, no need of a new client to write) • REST is particularly useful for restricted-profile devices such as mobile and PDAs for which the overhead of additional parameters like headers and other SOAP elements are less. 9/29/2013www.luqmanshareef.com 20
  • 21. Why SOAP? • SOAP is not only for Web. It has its own protocol. • SOAP Exposes application logic (not data) as service. Exposes named operations. • Can implement stateful web services. • SOAP Web services are useful in handling asynchronous processing and invocation. • SOAP has additional feature built on top of it which REST doesn’t. ▫ WS-Security ▫ WS-Reliable Messaging ▫ WS-Atomic Transactions • Most real-world applications are not simple and support complex operations, which require conversational state and contextual information to be maintained. With the SOAP approach, developers need not worry about writing this plumbing code into the application layer themselves. 9/29/2013www.luqmanshareef.com 21
  • 22. WSDL 2.0 • WSDL 2.0 is tailored for SOAP-based Web services • However, HTTP binding in WSDL 2.0 allows for good description of HTTP services ▫ <binding name="HttpBinding" interface="m:GetTemperature" type="http://www.w3.org/2005/08/wsdl/http"> <operation ref="m:location" whttp:method="GET" whttp:location="{country}/{city}"/> </binding> • It allows for an HTTP GET on http://weather.example/country/city: ▫ HTTP/1.1 200 Here's the temperature for you Content-Type: application/xml … <weather xmlns="…"> <temperature>23</temperature> </weather> • All HTTP methods are supported. 9/29/2013www.luqmanshareef.com 22