Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

Mike Taulty OData (NxtGen User Group UK)

  1. The Open Data Protocol (OData) Mike Taulty Microsoft UK mtaulty@microsoft.com mtaulty.com @mtaulty
  2. RESTful services
  3. client WLTM service for RESTful interactions client service 3 2 1 resources
  4. client WLTM service for RESTful interactions Application Code Application Code 2 Customer { ID = 2 } Customer { ID = 2 } XML Client Stack XML Server Stack BODY = <customer/> BODY = <customer/> URI = http://service?id=2 URI = http://service?id=2 VERB = POST STATUS = OK VERB = POST STATUS = OK HTTP Client Stack HTTP Server Stack client service
  5. key points involved here? 1. HTTP as the transport What’s so great about 2. URI that?indicates resource 1) Simplicity 3. VERB indicates action 2) Low barrier to entry 4. STATUS CODE3) Standardised indicates outcome technologies already proven on the internet 5. XML as the payload(s)
  6. ready to build? before you get to technologies 1) URI scheme for addressing resources? 2)someone must have (MVC) this WCF Can client compose done (REST) (REST) LINQ to XML additional ASP.NET WCF queries? already? 3) XML payload format? JSON WebClient IIS as well? 4) client payload format with Sharing service clients? 5) Including/linking to related data?
  7. OData is a specification
  8. OData builds on the RESTful fundamentals HTTP XML JSON to provide an open specification for exposing an abstract data model by adding URI addressing scheme payload using AtomPub, Atom and JSON metadata using the Entity Data Model batching mechanism for requests
  9. it’s the usual “build or buy” trade-off standard • productivity • existing frameworks/libraries • tooling support • existing skillsets custom • full control • does what you want and no more
  10. OData Basics typed Entry property service property entries need to have a ... feed primary key property link feed ... link all links are URI’s ... media link BLOB feed service must publish a service document typed Entry operation JSON listing top level feeds in AtomPub or ... ... operation typed Entry
  11. demo quick exploration of an OData service
  12. OData URIs and Querying http://odata.netflix.com/Catalog/ Genres(‘Action Classics’)/Titles ? $orderby=R resource path query options $orderby (asc, desc ) Collection /Genres $top Entry /Genres(‘Action Classics’) $skip Entry Property /Genres(‘Action Classics’)/Name $filter Entry Property (text) /Genres(‘Action Classics’)/Name/$value $expand Cardinality /Genres/$count $format (*) Navigation /Genres(‘Action Classics’)/Titles $select Navigation Links /Genres(‘Action Classics’)/$links/Titles $inlinecount Service Operation /ServiceOp?param1=‘val1’ $ - some custom option
  13. filters Logic Arithmetic String Date/Time eq add contains second ne sub endswith hour gt mul startswith minute gteq div length day lt mod indexof month lteq round insert year and floor or ceiling remove x 2 Type not replace isof substring cast tolower toupper trim concat
  14. demo querying OData services
  15. service metadata an odata service can offer metadata describing the service greatly facilitates building clients service description is represented using the Entity Data Model (EDM) fully docmented in the specification Visual Studio (e.g.) supports this metadata format via “Add Service Reference”
  16. demo accessing service metadata ( including http://bit.ly/odataVisualizer )
  17. operations specification also deals with INVOKE GET DELETE POST PUT client service client service maintaining links including MIME types for ATOM/JSON maintaining linkshere including creating links MERGE also applicable concurrency checking lists including partial via ETags concurrency checkingvia ETags including protocol versioning tunnelling over POST tunnelling over POST
  18. batching optimise round trips to the server be more “transactional” GET /Titles GET /People RESPONSE POST /People(‘Tom Cruise’) (multipart MIME) client service POST (multipart MIME) $Batch
  19. specification -> implementation
  20. OData on the server Custom via WCF Data Services SharePoint 2010 SQL Azure Azure Table Storage SQL Reporting Services IBM WebSphere
  21. WCF Data Services IDataServiceMetadataProvider ( ADO.NET Data Services or ‘Astoria’ ) IDataServiceQueryProvider Custom IDataServiceUpdateProvider config Provider • AcceptCountRequests Custom Data IDataServiceStreamProvider • AcceptProjectionRequests IDataServicePagingProvider defined ) ( dynamically • MaxProtocolVersion • MaxBatchCount • MaxChangesetCount • MaxExpandDepth • MaxObjectCountOnInsert • MaxResultsPerCollection • EntitySetAccessRule Host (IIS or self-hosted) • EntitySetPageSize • ServiceOperationAccessRule Custom Object WCF DataService Reflection Model Provider + IUpdatable Update Query Service Operations LINQ to SQL Model Interceptors Entity Sets Entity Framework Provider Entity Framework Model
  22. demo building an OData service
  23. OData on the client .NET – desktop, server, Silverlight, Windows Phone 7 Javascript iPhone (Objective C) Java PHP Ruby
  24. demo building an OData client
  25. more? www.odata.org or to see the website in odata services.odata.org/website/odata.svc
  26. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Advertisement