REST -Web services

15
WEB SERVICES THEORY & IMPLEMENTATION Abdul Munim Dibosh ([email protected]) CSE, BUET

description

A simple comparative analysis on Web Services. A brief description of REST-ful Web Service

Transcript of REST -Web services

Page 1: REST -Web services

WEB SERVICESTHEORY & IMPLEMENTATION

Abdul Munim Dibosh ([email protected])CSE, BUET

Page 2: REST -Web services

What’s Web Service

• Application components• Communicate using open protocols• Self contained and self describing• Can be consumed by any application

Page 3: REST -Web services

How does it work

• Internet protocol used : HTTP• Platform Elements:

SOAP(Simple Object Access Protocol)UDDI(Universal Description, Discovery & Integration)WSDL(Web Services Description Language)

Page 4: REST -Web services

Why Web Service

• Interoperability – Web services enable exchanging data between different applications and platforms.

• Can publish function or message to rest of the world• Reusable application components

Page 5: REST -Web services

Popular Web Services

Page 6: REST -Web services

SOAP

• Simple Object Access Protocol• Communication protocol• Format for sending messages• Platform independent• Based on XML• Allows to get around firewalls

Page 7: REST -Web services

WSDL

• Web Services Description Language• Based on XML• Used to describe web services• Used to locate web services

Page 8: REST -Web services

I have something new…

Page 9: REST -Web services

Introducing REST

• REST stands for Representational State Transfer• Large impact ; almost displaced SOAP and WSDL

Page 10: REST -Web services

RESTful Web Services

• Unique URL is representation of some object• Uses HTTP for CRUD(Create/Read/Update/Delete)

operations

Page 11: REST -Web services

REST vs SOAP

• Rest• Light-Weight• Human readable• Easy to build• Access named resources through a single consistent interface• Permits different data formats• Example: getUser(Id)

• Soap• Easy to consume-sometimes• Rigid-adheres to a contract (Standard Specification)• Exposes operations• Permits XML• Example: performTask(Id,task)

Page 12: REST -Web services

The main idea

• REST – Exposes a resource(object) via GET,POST etc.

What you will do with that object is up to you.• SOAP - Exposes named operations to perform business

logic.

Page 13: REST -Web services

Example-SOAP

• Query the details of a given User-<?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-en coding">

<soap:body pb="http://www.acme.com/phonebook"> <pb:GetUserDetails>

<pb:UserID>12345</pb:UserID> </pb:GetUserDetails>

</soap:Body> </soap:Envelope>

Page 14: REST -Web services

Example-REST

• Query the details of a given User-

http://www.acme.com/phonebook/UserDetails/12345

Page 15: REST -Web services

Enough talk, let's fight code…