rest -web services

Post on 30-Apr-2015

655 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

WEB SERVICESTHEORY & IMPLEMENTATION

Abdul Munim Dibosh (abdulmunim.buet@gmail.com)CSE, BUET

What’s Web Service

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

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)

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

Popular Web Services

SOAP

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

WSDL

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

I have something new…

Introducing REST

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

RESTful Web Services

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

operations

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)

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.

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>

Example-REST

• Query the details of a given User-

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

Enough talk, let's fight code…

top related