session title session sub title (optional) rest...multi tier web apps intra enterprise (dcom, corba)...
TRANSCRIPT
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]
• Evolution of Distributed Architecture
• SOA
• REST unplugged
• Q&A
Agenda
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
SOAP is transport neutral
SOAP based services can be highly Secure, Reliable, Discoverable and Interoperable
SOAP has specification
SOAP …
SOAP has deep protocol stack
Achieving Interop becomes challenging
Performance suffers
High barrier of entry
SOAP Limitations…
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
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
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
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
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
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
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
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
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
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)
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
REST Starter Kit [Microsoft.ServiceModel.Web]- Service Host- WebHelp, WebCache, - Web Protocol exception
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.
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
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
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
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
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
Contact
Blog Address
http://www.infosysblogs.com/microsoft/
Email Address
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
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!
© 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.