session title session sub title (optional) rest...multi tier web apps intra enterprise (dcom, corba)...

28
Atul Gupta Principal Architect | Infosys Technologies Ltd. | Microsoft MVP http://www.infosysblogs.com/microsoft/ | [email protected] Sudhanshu Hate Senior Architect| Infosys Technologies Ltd. http://www.infosysblogs.com/microsoft/ | [email protected]

Upload: others

Post on 11-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Atul Gupta Principal Architect | Infosys Technologies Ltd. | Microsoft MVPhttp://www.infosysblogs.com/microsoft/ | [email protected]

Sudhanshu HateSenior Architect| Infosys Technologies Ltd.http://www.infosysblogs.com/microsoft/ | [email protected]

Page 2: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

• Evolution of Distributed Architecture

• SOA

• REST unplugged

• Q&A

Agenda

Page 3: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Distributed Architecture Evolution

Multi tier Web Apps

Intra Enterprise (DCOM,

CORBA)

ESB

Inter Enterprise

(SOA using SOAP Services)

Enterprise B

90’s

1997-2002

> 2003

ESB

Enterprise A

SOAP Service

Page 4: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

SOAP is transport neutral

SOAP based services can be highly Secure, Reliable, Discoverable and Interoperable

SOAP has specification

SOAP …

Page 5: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

SOAP has deep protocol stack

Achieving Interop becomes challenging

Performance suffers

High barrier of entry

SOAP Limitations…

Page 6: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Representational State Transfer (REST) is

an architectural style for building services

on World Wide Web(WWW)

Dr. Roy Thomas Fielding introduce REST first time in year 2000 through his dissertation

Introducing REST

Page 7: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Typical Http call

Client Server

http://www.Resources.com/resource1

[GET]

Resource

Details

Resource1.html

Request

Response 200 OK

Resource

URI

GET (Operation)

Html response

Response Code (200, OK)

Stateless

Page 8: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

1. Everything that needs to be identified on Web should be treated as resource and be uniquely identified

e.g. http://ibuy.com/Order/1234

Resource is usually Noun and Not Verb

REST Design Principle - 1

Page 9: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

2. Use Standard http methods to operate on identified resources.

GET – Retrieve Information

POST – Create or Append

PUT – Update the information

DELETE - Remove

REST Design Principle - 2

Page 10: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

GetTask(TaskId string)

GET http://localhost:38161/TaskManagement.svc/Tasks/{taskId}

InsertTask (TaskObj Object)

POST http://localhost:38161/TaskManagement.svc/Task

DeleteTask (TaskId string)DELETE http://localhost:38161/TaskManagement.svc/Task/{taskid}

UpdateTask (TaskObj Object)

PUT http://localhost:38161/TaskManagement.svc/Tasks/Task

Mapping SOAP methods to REST

Page 11: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

3. Connect Resources together

<Order ref =”http://ibuy.com/order/1234”/>

<amount> 15000 </amount>

<product ref= “http://ibuy.com/product/455” />

<customer ref =”http://ibuy.com/customer/20084 />

</ Order >

REST Design Principle - 3

Page 12: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

4. Allow multiple representation for same

resource

e.g. Same Order can be represented in XML, Word Document,

PDF, (X)HTML, JSON, ATOM or in various other formats.

5. Communication should be always stateless.

REST Design principles 4 and 5

Page 13: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Well Constructed URIs

HTTP Verbs

GET – Fetch

PUT – Update/Insert

DELETE – Delete

POST – Append

Standard Representations

Purists RESTfullness Pragmatists

Hi-REST Low-REST

Hi-REST Low-REST

Page 14: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Framework Support for REST

.Net 3.5 WCF has built in support for REST through System.ServiceModel.Web

New binding to support Http – webHttpBindingDoes not use SOAP envelops

Supports Http, https transports

UriTemplateBinds a WCF operation to URI

WebGet, WebInvokeBinds a WCF operation to Http method

Page 15: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

HT

TP R

eq

ue

st w

ith

re

qu

ire

d r

esp

on

se

form

at

PO

X

JSO

N

Ato

m F

eed

20

0, O

K

Resource A Resource B

REST Architecture (.NET stack)

Page 17: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

REST Starter Kit

New features supporting RESTful servicesWebHelp, WebCache, ProtocolException

ServiceHost

Microsoft.ServiceModel.Web.dll

Visual Studio 2008 Templates

REST Collections/Singleton Services

Atom Feed/Atom Publishing Protocol

HTTP/POX Services

REST Samples

Codeplex Project

Released at PDC

Written by WCF team

Features may be included in .NET 4.0

Page 18: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

REST Starter Kit [Microsoft.ServiceModel.Web]- Service Host- WebHelp, WebCache, - Web Protocol exception

Page 19: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Implementing Security

REST leverages security over http, provided through https.

For Authentication it can use Basic, Digest or Hash Message Authentication Code (HMAC) approach.

HMAC is recommended for enterprise scenarios.

“Access Id” (private key) and “Secret Access Key” (shared key) together is used to secure services.

Page 20: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Reliability and Transactions

• Reliability can be achieved using Idempotent

operations like PUT and DELETE

• Transaction support can be provided by

treating Transaction itself as a resource.

1. Create Transaction (CREATE)

2. Associate other resources to a Transaction though PUT or

DELETE, ensure reliability through idempotent

3. Retrieve transaction (GET)

4. Commit (PUT) or Rollback(DELETE) the transaction

Page 21: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Distributed Architecture Evolution

Multi tier Web Apps

Intra Enterprise (DCOM,

CORBA)

ESB

Inter Enterprise

(SOA using SOAP Services)

Enterprise B

90’s

1997-2002

2003 - ongoing

ESBWeb 2.0 , Social

Apps, SaaS,

Cloud Computing

>2005

Enterprise A

SOAP or REST

Http Supported Web Apps grew

Exponentially during the same time

Page 22: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

REST adoption

Amazon has both REST and SOAP interfaces, 85% of their usage is REST interface

All Microsoft Azure Cloud Services are REST based

Amazon’s S3 (Simple Storage Service), Flexible Payment, Queue, Search Service exposes both REST and SOAP interfaces

Google, Yahoo services, Flickr, Facebook, Twitter are built using REST services

Page 23: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Architectural Constraints REST SOAP

Scalability

Security

Reliability

Interoperability

Performance

Transactions

Multi Device

Multi Transport

Time to Market

High

Medium

Low

SOAP OR REST for Architecture

Page 24: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

References

Dr. Fielding’s Dissertationhttp://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_3

WCF Screencasthttp://msdn.microsoft.com/en-us/netframework/wcf-screencasts.aspx

http://www.pluralsight.com/community/blogs/aaron/archive/2009/03/17/wcf-rest-screencasts-videos.aspx

REST Starter kithttp://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24644

Page 25: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Contact

Blog Address

http://www.infosysblogs.com/microsoft/

Email Address

[email protected]

[email protected]

Page 26: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Summary

• Evolution of Distributed Architecture

• SOA

• Complexities with SOAP

• REST unplugged

• Introduction

• Typical Http call

• REST Design Principles

• .NET framework support for REST

• Demo – Task Management REST Service

• Demo – Consuming REST on Client

• Demo – REST Starter Kit

• Security, Reliability, Transaction considerations

• REST adoption

• Choosing REST or SOAP

Page 27: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

Feedback / QnA

Your Feedback is Important!

Please take a few moments to fill out our online feedback form

Use the Question Manager on LiveMeeting to ask your questions now!

Page 28: Session Title Session Sub Title (optional) REST...Multi tier Web Apps Intra Enterprise (DCOM, CORBA) ESB Inter Enterprise (SOA using SOAP Services) Enterprise B 90’s 1997-2002 2003

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.

MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.