Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Building RESTful Applications with OData

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
Odata
Odata
Wird geladen in …3
×

Hier ansehen

1 von 30 Anzeige

Building RESTful Applications with OData

Herunterladen, um offline zu lesen

Applications today are expected to expose their data and consume data-centric services via REST. In this session we discuss what REST is and have an overview of WCF Data Services and see how we can REST enable your data using the Open Data Protocol (OData). Then you will learn how to leverage existing skills related to Visual Studio, LINQ and data access to customize the behavior, control-flow, security model and experience of your data service. We will then see how to enable data-binding to traditional ASP.NET controls as well as Silverlight and Excel PowerPivot. We’ll then turn to consuming SharePoint and other OData based applications in .NET as well as from a non-Microsoft client. This is a very demo intensive session.

Applications today are expected to expose their data and consume data-centric services via REST. In this session we discuss what REST is and have an overview of WCF Data Services and see how we can REST enable your data using the Open Data Protocol (OData). Then you will learn how to leverage existing skills related to Visual Studio, LINQ and data access to customize the behavior, control-flow, security model and experience of your data service. We will then see how to enable data-binding to traditional ASP.NET controls as well as Silverlight and Excel PowerPivot. We’ll then turn to consuming SharePoint and other OData based applications in .NET as well as from a non-Microsoft client. This is a very demo intensive session.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Andere mochten auch (18)

Anzeige

Ähnlich wie Building RESTful Applications with OData (20)

Anzeige

Aktuellste (20)

Building RESTful Applications with OData

  1. 1. Building RESTful Applications with the Open Data Protocol Todd Anglin Chief Evangelist, Telerik Level: Intermediate
  2. 2. Introductions <ul><li>Todd Anglin </li></ul><ul><li>Chief Evangelist, Telerik </li></ul><ul><li>Microsoft MVP </li></ul><ul><li>ASP Insider </li></ul><ul><li>President NHDNUG & O’Reilly Author </li></ul>@toddanglin TelerikWatch.com
  3. 3. The Plan
  4. 4. What you should learn today: <ul><li>What is REST/OData </li></ul><ul><li>Who created REST/OData </li></ul><ul><li>Why use REST/OData </li></ul><ul><li>When should you use REST/OData </li></ul><ul><li>Where can you find REST/OData </li></ul>
  5. 5. How did we get here?
  6. 6. “ There is a vast amount of data available today and data is now being collected and stored at a rate never seen before. Much, if not most, of this data however is locked into specific applications or formats and difficult to access or to integrate into new uses.”  - OData.org
  7. 7. State of Data & Services Internal SQL My App App Data CMS Share Point Cloud Custom API SQL JSON Services FB
  8. 8. What is REST? <ul><li>Re presentational S tate T ransfer </li></ul><ul><li>What is the biggest REST implementation? </li></ul><ul><ul><li>World Wide Web! </li></ul></ul>REST is NOT a standard! (But it uses standards) HTTP + URLs + XML*
  9. 9. REST Principles
  10. 10. REST Illustrated Magic Kingdom (Resource) http://disneyworld.com/parks/magic-kingdom Resource URL Representation URL Click (State Transfer) Representation
  11. 11. RESTful Services <ul><li>Core idea: </li></ul>let's have computers use the web the way humans do
  12. 12. Alternatives to REST <ul><li>Most common: SOAP and RPC </li></ul><ul><li>Why use SOAP (vs REST)? </li></ul><ul><ul><li>Enterprise security features (WS-Security) </li></ul></ul><ul><ul><li>ACID Transactions (WS-AtomicTransaction) </li></ul></ul><ul><ul><li>Message error recovery (WS-ReliableMessaging) </li></ul></ul>SOAP services focus on exposing application logic REST services focus on exposing “data” (or CRUD operations on data)
  13. 13. <ul><li>OData </li></ul>does for data what REST does for services
  14. 14. (Finally!) What is OData? <ul><li>HTTP </li></ul><ul><ul><li>REST-based services </li></ul></ul><ul><li>AtomPub </li></ul><ul><ul><li>Data structure </li></ul></ul><ul><li>JSON </li></ul><ul><ul><li>Data delivery format </li></ul></ul>Data silo buster
  15. 15. What do web services require? <ul><li>A way to discover a service provider </li></ul><ul><li>A way to discover available services at a provider </li></ul><ul><li>A way to describe how to interface with service </li></ul><ul><li>A way to execute functions provided by a service </li></ul><ul><li>A standard messaging format </li></ul><ul><li>A way to represent the data in exchange </li></ul>
  16. 16. Why? <ul><li>Interoperability </li></ul><ul><ul><li>Predictable access to data from any system </li></ul></ul><ul><li>Gaining popularity </li></ul><ul><ul><li>SharePoint 2010 </li></ul></ul><ul><ul><li>SQL Server 2008 R2 </li></ul></ul><ul><ul><li>IBM WebSphere eXtreme Scale </li></ul></ul><ul><ul><li>Azure Table Storage </li></ul></ul><ul><ul><li>Telerik TeamPulse </li></ul></ul><ul><ul><li>… </li></ul></ul>
  17. 17. REST AND ODATA IN ACTION <ul><li>DEMO </li></ul>
  18. 18. Consuming OData <ul><li>Windows Phone 7 / iPhone / Mobile </li></ul><ul><li>AJAX / Javascript </li></ul><ul><li>PHP / Java / .NET </li></ul><ul><li>Silverlight </li></ul><ul><li>PowerPivot </li></ul><ul><li>Simple HTTP Requests (GET, POST, PUT, DELETE) </li></ul><ul><li>More… </li></ul>
  19. 19. Visual Studio Tools <ul><li>Open Data Protocol Visualizer </li></ul>
  20. 20. CONSUMING EXISTING ODATA <ul><li>DEMO </li></ul>
  21. 21. Creating OData Service <ul><li>As simple as returning proper XML/JSON </li></ul><ul><ul><li>No specific platform requirements </li></ul></ul><ul><li>Ways to build: </li></ul><ul><ul><li>Using Visual Studio tools (WCF Data Services) </li></ul></ul><ul><ul><li>SharePoint Lists </li></ul></ul><ul><ul><li>Azure Table Storage </li></ul></ul><ul><ul><li>Manually produce XML </li></ul></ul>
  22. 22. WCF Data Services (Astoria) <ul><li>Build RESTful services on Microsoft platform </li></ul><ul><ul><li>Roots of OData protocol </li></ul></ul><ul><li>Built on WCF </li></ul><ul><ul><li>Supports ATOM (XML) and JSON data representations </li></ul></ul><ul><li>Automates REST for data </li></ul><ul><ul><li>Anything that implements IQueryable<T> or IUpdatable<T> </li></ul></ul><ul><ul><li>EX: EF, LinqToSQL, 3 rd party ORM, etc. </li></ul></ul>
  23. 23. WCF DATA SERVICES BASICS <ul><li>DEMO </li></ul>
  24. 24. Service Operations <ul><li>Functions exposed by OData </li></ul><ul><ul><li>Similar to RPC </li></ul></ul><ul><ul><li>Accept zero or more primitive type input params </li></ul></ul><ul><ul><li>Can return scalar value </li></ul></ul><ul><ul><li>[WebGet] is used for an addressable query </li></ul></ul><ul><ul><li>[WebInvoke] is used for insert, update, and delete </li></ul></ul>http://.../OData.svc/ GetProductsByRating ?rating=5
  25. 25. Interceptors <ul><li>Query Interceptors </li></ul><ul><ul><li>Logic runs when resource is requested </li></ul></ul><ul><ul><li>Uses: limit the data viewed, log, perform security check </li></ul></ul><ul><li>Change Interceptors </li></ul><ul><ul><li>Logic runs when a change (Add/Edit/Delete) request is made (HTTP PUT/POST/DELETE) </li></ul></ul>
  26. 26. SERVICE OPS & INTERCEPTORS <ul><li>DEMO </li></ul>
  27. 27. Securing Data Services <ul><li>Remember! </li></ul><ul><ul><li>REST is NOT a protocol, it’s a pattern </li></ul></ul><ul><li>Same security that applies to HTTP, AtomPub, JSON </li></ul><ul><li>Other options: </li></ul><ul><ul><li>EntitySetRights </li></ul></ul><ul><ul><li>Hiding sensitive data with [IgnoreProperties] </li></ul></ul><ul><ul><li>Infrastructure security – SSL, IP Filtering </li></ul></ul><ul><ul><li>QueryInterceptors </li></ul></ul>
  28. 28. OData & SharePoint 2010 <ul><li>ListData.svc </li></ul><ul><ul><li>Out-of-the-box OData access to SharePoint data </li></ul></ul><ul><ul><li>Data is NOT anonymously available! </li></ul></ul>http://siteurl /_vti_bin/listdata.svc /Announcements
  29. 29. When to REST? <ul><li>Stateless web services </li></ul><ul><li>Scalable web services (via HTTP caching) </li></ul><ul><li>Mutually understood context (OData) </li></ul><ul><li>Restricted bandwidth (Mobile) </li></ul>Always, except when there is a reason NOT to REST
  30. 30. [Q & A] <ul><li>Thanks! Gracias! Mersi! Blagodarya! </li></ul>@toddanglin telerikwatch.com [email_address]

×