Your SlideShare is downloading. ×
0
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Wcf rest api introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Wcf rest api introduction

1,428

Published on

Presentation at DDDMelbourne.

Presentation at DDDMelbourne.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,428
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
31
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • http://msdn.microsoft.com/en-us/library/dd203052.aspx
  • 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.
  • Transcript

    • 1. Doing REST with new WCF Web API
      Himanshu Desai
      Senior Consultant - Readify
      Discover. Master. Influence.
    • 2. Agenda
      Web as Resource Oriented Architecture
      • Current Industry Trends
      Overview of REST
      What is REST?
      REST Constraints
      REST Benefits
      REST using WCF
      REST Support in WCF
      WCF Web API
      Discover. Master. Influence.
    • 3. Resource Oriented Architecture
      3
      Discover. Master. Influence.
    • 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
    • 6. REST Constraints
      Client - server
      Stateless
      Cacheable
      Layered
      Uniform interface
      Discover. Master. Influence.
      6
    • 7. REST Constraints
      Uniform interface
      Client - server
      Stateless
      Cacheable
      Layered
      Discover. Master. Influence.
      7
    • 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
    • 11. RESTful Services-2
      11
      Discover. Master. Influence.
    • 12. RESTful Services-3
      Designing Resource Representation
      Discover. Master. Influence.
      12
    • 13. RESTful Services-4
      Designing Resource Representation
      <User>
      < Email>aaron@pluralsight.com</Email>
      <Name>Aaron Skonnard</Name>
      </User>
      Supporting Alternate Representation
      ?tag={tag}&format=json
      {username}?tag={tag}&format=json
      users/{username}?format=json
      users/{username}/profile?format=json
      Security Consideration
      Providing Resource Metadata
      Avoiding RPC Tendencies
      13
      Discover. Master. Influence.
    • 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
    • 19. REST Using WCF
      Discover. Master. Influence.
    • 20. Rest Support Comparison
      Discover. Master. Influence.
      20
    • 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
    • 23. Components
      Content Negotiation
      Central Configuration (Fluent API)
      Http Classes
      Operation Handler Factory
      Error Handler
      Message Handler Factory(Channel Level)
      Discover. Master. Influence.
      23
    • 24. Classes for Request & Response
      Discover. Master. Influence.
      24
    • 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
    • 29. Demo
      Content Negotiation
      Discover. Master. Influence.
    • 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
    • 31. Operation Handler Factory
      Request Pipeline
      Response Pipeline
      Operation Handler
      Operation Handler
      Operation Handler
      Operation Handler
      Operation Handler
      Operation Handler
      Dispatch
      Discover. Master. Influence.
      28
    • 32. Message Handler Factory
      Operation
      Message Handler4
      Message Handler3
      Message Handler 1
      Message Handler2
      Discover. Master. Influence.
      29
    • 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
    • 34. Consuming RESTful Services
      Consuming with Javascript
      Consuming with WCF
      31
      Discover. Master. Influence.
    • 35. Consuming Web API with Javascript
      32
      Discover. Master. Influence.
    • 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
    • 37. Demo
      Query Composition & HttpClient
      Discover. Master. Influence.
    • 38. Questions?
      Discover. Master. Influence.

    ×