1 / 26

REST- baserade tjänster med WCF ASP.NET Web API

REST- baserade tjänster med WCF ASP.NET Web API. Robert Folkesson. Active Solution. Who AM I?. REST?. Dissertation by Roy Fielding 2000 “Architectural Styles and the Design of Network-based Software Architectures” ReST = Representational State Transfer. Architectural constraints.

Download Presentation

REST- baserade tjänster med WCF ASP.NET Web API

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. REST-baseradetjänster med WCF ASP.NET Web API Robert Folkesson Active Solution

  2. Who AM I?

  3. REST? • Dissertation by Roy Fielding 2000 • “Architectural Styles and the Design of Network-based Software Architectures” • ReST = Representational State Transfer

  4. Architecturalconstraints • Client–server • Stateless • Cacheable • Layered system • Uniform Interface

  5. Scalability GET http://fabrikam.com/API/User/42

  6. Guiding principles of REST-interfaces • Identificationofresources • Manipulation of resources through representations of these resources • Self-descriptivemessages • Hypermedia as the engine of application state

  7. HATEOASHypermedia as the engineofapplicationstate

  8. Exampleof hypermedia representation (Netflix)

  9. Richardsons maturitymodel Gloryof REST Level 3: Hypermedia Controls Level 2: HTPP Verbs Level 1: Resources Level 0: The swampof POX

  10. REST on Microsoft – somehistory • WCF pre-3.5: painful… • WCF 3.5: WebHttpBinding. • WCF REST Starter Kit (no longer supported) • WCF Data Services (OData) • WCF Web API - Preview 1 - 6

  11. WCF ASP.NET Web API

  12. http://www.asp.net/web-api • Goal: One HTTP/ REST / Hypermedia API Fx • Integrated in ASP.NET: Best ofbothworld

  13. WCF to ASP.NET Web API WCF Web APIASP.NET Web API Service => Web API controller Operation => Action Service contract => n/a Endpoint => n/a URI templates => ASP.NET Routing Messagehandlers => Same Formatters => Same Operation handlers => Filters, modelbinders

  14. DEMO – File new

  15. Media types & Media Formatters

  16. Media types & Media Formatters • Built in support for: • XML • JSON • form-urlencodeddata • Can be extendedwithcustomMedia Formatters

  17. DEMO – Media Typeformatter

  18. Web API on NuGet • Web API hosted in ASP.NET: • AspNetWebApi • Self-hostedWeb API: • AspNetWebApi.Selfhost • HttpClientincluding XML and JSON formatters: • System.Net.Http.Formatting • JsonValuefor navigating and manipulating JSON: • System.JsonNewtonsoft.Json

  19. Node-style Web API? http://blogs.msdn.com/b/youssefm/archive/2012/02/24/writing-a-lightweight-web-service-using-webapi-building-blocks.aspx

  20. DEMO – SELF HOSTING

  21. Web API can be used for all levels Gloryof REST Level 3: Hypermedia Controls Level 2: HTPP Verbs ASP.NET Web API Level 1: Resources Level 0: The swampof POX

  22. OAuth/Claimsbasedsecurity http://zamd.net/

  23. Open Source: http://aspnetwebapi.codeplex.com

  24. Somegoodreading

  25. Thank you! Robert Folkesson | Active Solution robert.folkesson@activesolution.se | @rfolkes www.robertfolkesson.se

More Related