4. Current Industry Trends A Move to cloud-based computing A Migration away from SOAP More browser based Apps Adoption of REST Other standards like OAuth, WebSockets Discover. Master. Influence. 4
5. What is REST? Representational State Transfer Idea floated by Roy Fielding Architecture Style (not a protocol or spec and it is not restricted to HTTP) Discover. Master. Influence. 5
8. REST Benefits Scalability of component interactions Evolvability Reach Intermediary components to reduce latency, enforce security and encapsulate legacy systems Discover. Master. Influence. 8
9. RESTful Services-1 A Traditional RPC based Service Moving from Verb to Noun Users Bookmarks Discover. Master. Influence. 9
10. RESTful Services-2 Designing the Uri Template An invidual user account An individual bookmark A user’s collection of private/public bookmark Collection of all public bookmarks Applying the Uniform HTTP Interface Discover. Master. Influence. 10
14. GET Example REQUEST GET /index.html Host: www.example.com RESPONSE HTTP/1.1 200 OK Etag: „3f80f-1b6-3e1cb03b” Content-Type: text/html; charset=UTF-8 l Discover. Master. Influence. 14
15. POST Example POST /order HTTP/1.1 Host: amazon.net Content-Type: application/xml Content-Length: 216 <order xmlns="http://schemas.amazon.net/order"> <drink>latte</drink> </order> 201 Created Location: http://amazon.net/order/1234 ContentType: application/xml <order xmlns="http://schemas.amazon.net/order"> ... l Discover. Master. Influence. 15
16. PUT Example PUT /payment/1234 HTTP/1.1 Host: amazon.net Content-Type: application/xml Content-Length: 216 <payment xmlns="http://schemas.amazon.net/order"> <cardNumber>...</cardNumber> </order> 200 OK ContentType: application/vnd.amazon+xmlxmlns="http://schemas.amazon.net/order"> <drink>Latte</drink> <link href=„payment/1234” rel=„http://relations.amazon.net/payment”/> </order> l Discover. Master. Influence. 16
17. Central Principle Existence of resource which is referenced with a global identifier (e.g. a image, document etc.) Communicate via a standard interface (e.g. HTTP) Exchange representations of these resources (HTML.XML,JSON etc.) Discover. Master. Influence. 17
18. RESTful web services Collection of data Base URI e.g. http://ebay.com/items/1 Internet Media type of the data supported by the web service. (JSON,XML etc.) Set of operation supported by the web service using HTTP methods (POST,GET,PUT or DELETE) Discover. Master. Influence. 18
21. WCF Web API HTTP is now a first class Content negotiation Automatic help pages Service Routes Integration with ASP.NET Caching Reach any client (Browser, Devices, Silverlight, Desktop) Discover. Master. Influence. 21
22. Resource Architecture Op Handler2 Transport+Encoder Message Handler 1 Response Discover. Master. Influence. 22 Dispatcher GetById? GetById? Op Handler 3 Op Handler 4 Op Handler 1 Message Handler 2 Request
28. Content Negotiation Support for Multiple Formats including an add-in model if you want xml ,it gives xml and if you want Json, it gives Json Discover. Master. Influence. 25
30. Operation Handler Factory Responsible for creating new instances of Media Type Formatters and Operation Handlers. Media Type Formatter Operation Handler - an abstract base class used to create transfer a set of input into a set of output Discover. Master. Influence. 27
33. Query Composition Support for OData like query support http://localhost/AlbumService/albums?$Top=5 http://localhost/AlbumService/albums?$Top=5&$OrderBy=Title Discover. Master. Influence. 30
36. HttpClient Helps you access web resources using Linq var client = new HttpClient(address); var personQuery = client.CreateQuery<Person>(); var results = personQuery.ExecuteAsync().ContinueWith(p => { //Dosomething here }); Discover. Master. Influence. 33
Representational State TransferIdea floated by Roy FieldingArchitectural Style (not a protocol or spec and it is not restricted to HTTP)ConceptREST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource can be essentially any coherent and meaningful concept that may be addressed. A representation of a resource is typically a document that captures the current or intended state of a resource.At any particular time, a client can either be in transition between application states or "at rest". A client in a rest state is able to interact with its user, but creates no load and consumes no per-client storage on the servers or on the network.The client begins sending requests when it is ready to make the transition to a new state. While one or more requests are outstanding, the client is considered to be in transition. The representation of each application state contains links that may be used next time the client chooses to initiate a new state transition.REST was initially described in the context of HTTP, but is not limited to that protocol. RESTful architectures can be based on other Application Layer protocols if they already provide a rich and uniform vocabulary for applications based on the transfer of meaningful representational state. RESTful applications maximize the use of the pre-existing, well-defined interface and other built-in capabilities provided by the chosen network protocol, and minimize the addition of new application-specific features on top of it.
Evolvability In a RESTful system the entire infrastructure- including intermediaries such as load-balancers, caches, proxies etc. becomes participants in the communication.
Evolvability In a RESTful system the entire infrastructure- including intermediaries such as load-balancers, caches, proxies etc. becomes participants in the communication.
Evolvability In a RESTful system the entire infrastructure- including intermediaries such as load-balancers, caches, proxies etc. becomes participants in the communication.
Evolvability In a RESTful system the entire infrastructure- including intermediaries such as load-balancers, caches, proxies etc. becomes participants in the communication.
In 3.5 & 4.0New Attributes (WebGet/WebInvoke)New Binding (WebHttpBinding)Routing, help pages etc.Partial Support for Content negotiationIn .NET 4, Out of box XML and Json were supported. If you need to support other types , you need to extent webcontenttypemapper.Service routes- provides compile time checking. Integrates with ASP.NET RoutingYou host service which is then available as a route.WCF Web APIHTTP is now a first class Content negotiationAutomatic help pagesService RoutesIntegration with ASP.NET CachingReach any client (Browser, Devices, Silverlight, Desktop)
Service routes- provides compile time checking. Integrates with ASP.NET RoutingYou host service which is then available as a route.