Unlocking the secrets of REST with WCF Glenn Block Blogs/msdn.com/gblock @gblock
REST, Definition vs Practice REST by definition is clear In practice REST is a highly overloaded term REST in practice means over HTTP
Richardson’s HTTP Maturity model Hypermedia HTTP URI
Level 0 – Single URI / Single Verb SOAP Envelope (POST) Create Update \OrderService.svc Order System Submit Delete Cancel Approve Find
Level 1 – Multi URI / Single Verb XML/JSON – GET Create Orders/Create Update Orders/Update Order System Submit Orders/Submit Delete Orders/Delete Cancel Orders/Cancel Approve Orders/Approve Find Orders/Find
Level 2 – Multi URI / Multi Verb XML/JSON/ATOM PUT Orders/ POST Orders/1234 POST Order System Orders/Submitted DELETE Orders/1234 POST Orders/Cancelled POST Orders/Approved GET Orders/1234
Level 2 – Hypermedia aware Custom media types GET Orders/ <link rel=“Update” …/> Orders/1234 <link rel=“Submit” …/> Order System Orders/Submitted <link rel=“Delete” …/> Orders/1234 <link rel=“Cancel” …/> Orders/Cancelled <link rel=“Approve” …/> Orders/Approved <link rel=“View” …/> Orders/1234
Hypermedia what? HTTP/1.1 200 OK Content-Length: 421 Content-Type: application/vnd.ConstosoOrders+xml Date: Sun, 3 May 2009 18:22:11 GMT <order xmlns="http://contoso.com" xlmns:atom="http://www.w3.org/2005/Atom"> <OrderID>1234</OrderID> <-- Order details --/> <link rel=“Submit” href=“http://contoso.com/Orders/1234/Submitted”/> <link rel=“Delete” href=“http://contoso.com/Orders/1234”/> <link rel=“Cancel” href=“http://contoso.com/Orders/1234/Cancelled”/> <link rel=“Approve” href=“http://contoso.com/Orders/1234/Approved”/> <link rel=“View” href=“http://contoso.com/Orders/1234”/> </order>
Browser Devices WCF Silverlight Desktop Reach any client WCF already supports exposing services over HTTP. We have heard for you that is a good start but you want us to go further Desktop
Code is easier to maintain Service Separation of concerns Testability "Raw" HTTP HTTP Concerns Simplified Configuration
Separating out HTTP and other concerns Application concerns / CLR Objects Handler HTTP Message Operation Low Level HTTP specific concerns / HTTP Only Http Channel HTTP Message
Stay up to date with MSDN Belux Register for our newsletters and stay up to date: http://www.msdn-newsletters.be Technical updates Event announcements and registration Top downloads Follow our blog http://blogs.msdn.com/belux Join us on Facebook http://www.facebook.com/msdnbe http://www.facebook.com/msdnbelux LinkedIn: http://linkd.in/msdnbelux/ Twitter: @msdnbelux Download MSDN/TechNet Desktop Gadget http://bit.ly/msdntngadget Please keep this slide
TechDays 2011 On-Demand Watch this session on-demand via Channel9 http://channel9.msdn.com/belux Download to your favorite MP3 or video player Get access to slides and recommended resources by the speakers
THANK YOU