InfoQ

News

Astoria: Microsoft's RESTful Data Services

Posted by Hartmut Wilms on May 04, 2007

Community
.NET
Topics
Web Services ,
REST
Tags
Microsoft ,
Astoria

Microsoft's RESTful Data Services

Microsoft announced the Project Astoria MIX '07. Astoria offers a RESTful approach to expose data as data services on the web.
The Astoria Online Service describes the goal of Microsoft Astoria as

[...]to enable applications to expose data as a data service that can be consumed by web clients within a corporate network and across the internet. The data service is reachable over HTTP, and URIs are used to identify the various pieces of information available through the service. Interactions with the data service happens in terms of HTTP verbs such as GET, POST, PUT and DELETE, and the data exchanged in those interactions is represented in simple formats such as XML and JSON.

The Microsoft Codename "Astoria" Overview document shows how data is addressed and represented by Astoria data services. In order to address data with Astoria data services the following addressing scheme is used: http://host/vdir//{{<[predicate]>}. For instance the URI http://myserver/data.svc/Customers points to a resource, which contains all customer instances. A single customer might be referenced by the following resource URI: http://myserver/data.svc/Customers[ALFKI], whereas "ALFKI" represents a unique key within the customer data.

Predicates can be integrated into resource URIs, e.g. http://myserver/data.svc/Customers[City eq 'London'], as well as query string options, which control the output:

http://myserver/data.svc/Customers?$orderby=City
http://myserver/data.svc/Customers?$top=5
http://myserver/data.svc/Customers?$skip=30&$take=10

Concerning the output or data representation Astoria supports plain XML, JSON (JavaScript Object Notation) and a subset of RDF+XML. The default data representation is XML, e.g. http://myserver/data.svc/Customers[ALFKI] might respond with:

<DataService xml:base="http://myserver/data.svc">
 <Customers>
  <Customer uri="Customers[ALFKI]">
   <CustomerID>ALFKICustomerID> 
   <CompanyName>Alfreds FutterkisteCompanyName> 
   <ContactName>Maria AndersContactName> 
   <ContactTitle>Sales RepresentativeContactTitle> 
   <Address>Obere Str. 57Address> 
   <City>BerlinCity> 
   <Region /> 
   <PostalCode>12209PostalCode> 
   <Country>GermanyCountry> 
   <Phone>030-0074321Phone> 
   <Fax>030-0076545Fax> 
   <Orders href="Customers[ALFKI]/Orders" /> 
  Customer>
 Customers>
DataService>

The root "DataService" always contains the base URI of any resource represented by the service. Navigational nodes, which represent associated resources, contain relative URIs. In the example the orders of customer "ALFKI" are pointed to by the concatenation of the base URI (within the root node) with the relative URI (within the Orders node): "http://myserver/data.svc" + "/" + "Customers[ALFKI]/Orders".

According to Microsoft Astoria offers an easy way of implementing RESTful web services primarily targeted at providing data. In addition to GETting data from a data service data can also be updated or inserted via HTTP PUT or HTTP POST.

Udi Dahan is very skeptical about the usefulness and relevance of Astoria and Microsoft's data service approach in general:

But I’ve got to say, I’ve been against these “data services” from day one. The REST style is most applicable for large, chunky resources - while this seems to be targeting single tables in the database. Look at this discussion on REST vs SOA for some examples.

Danny Ayers, on the other hand, thinks that Microsoft approaches the Semantic Web with Astoria. Alex James provides an expansive overview of the Astoria buzz.

No comments

Watch Thread Reply

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.