共用方式為


OData interoperability with .NET, Java, PHP, iPhone and more

OData-logo Wouldn’t that be cool to have more ways to unlock your data and free it from applications silos?
Today at MIX10, we presented about how Open Data Protocol (OData) can contribute to a more programmable web through demos consuming a Netflix OData feed in various scenarios. We also announced a series of new and updated OData SDKs for PHP, Java, Objective C (iPhone & Mac,) and JavaScript (AJAX and Palm WebOS). The SDKs can be found on the www.odata.org website.

OData SDKs for PHP, Java, Objective C (iPhone & Mac,) and JavaScript (AJAX and Palm WebOS).

Today we are announcing a new version of the OData SDK for PHP (previously called Toolkit for PHP with ADO.NET/WCF Data Services). This version includes new features like the capability of handling large result sets of data using an automated paging mechanism and a new sample built on top of an OData feed exposing the Netflix catalog, which we are covering in detail in this blog post. Link for more detail on the OData SDK for PHP.

We also announced today the new OData SDK for Objective C which facilitates the development of applications for iPhone and Mac OS X connecting with OData services. This early version is a Community Technology Preview (CTP) and it supports read operations only and it has been tested on a limited set of scenarios. The download includes a sample iPhone application to browse the new NetFlix OData service hosted in Azure.

ODataSDKforIphoneObjectiveC

Link for more details on the OData SDK for Ojective C Community Technology Preview (CTP)

Finally, Noelios has just updated the Restlet Extension for OData – a set of tools and libraries for Java. Read Jerome Louvel’s post Restlet supports OData, the Open Data Protocol for more details. Noelios has also released a new detailed tutorial for developers who want to access OData services in Java.

The list of OData SDKs is available at http://www.odata.org/developers/odata-sdk.

About Open Data protocol - oData

In essence, the purpose of the OData is to feed the web with more consumable data and give the developers and entrepreneur more power to create new scenarios.

OData enables data integration across a broad range of clients, servers, services, and tools. OData builds on a few conventions, popularized by AtomPub, to using REST-based data services. These services allow resources, identified using Uniform Resource Identifiers (URIs) and defined in an abstract data model, to be read and edited by web clients using simple HTTP messages. For more details, consult the protocol documentation on the OData site where you will also find a list of services and products that are already using OData.
Read "Open Data for the Open Web" by
Doug Purdy for more perspective on OData.

The Netflix demo scenario

Today at MIX10, Doug Purdy demoed how you can quickly build a simple application consuming OData feeds, with Silverlight and also showed a demo running on the Palm webOS leveraging the OData JavaScript library. We’re following up, using the OData SDK for PHP and the OData feed exposed by Netflix, we’ve built a web application that allows users to search through the Netflix movie archives.

The demo starts with a search form with multiple pull-down menus you can use to narrow the search for titles in the catalog. To keep the demo simple, we limited on purpose the set of the fields that could be used to build an advanced search on the OData service. We actually use only the “Genre” and “Language” options which are prepopulated with values coming from the Netflix OData feed and the “Name” (movie title):

php-odata-netflix-demo-search

Once the user has selected his criteria and hit search, the PHP application calls the Netflix OData feed through a simple method call, highlighted below:

OData_PHP_snippet

And then a list of corresponding titles is returned by the Netflix oData feed. The result set is filtered and sorted by the Netflix service; you just have to display the data in a pretty HTML page:

php-odata-netflix-demo-list

Netflix’s OData backend runs on Windows Azure and SQL Azure to produce the OData feeds. OData being an open specification, there are many ways to build a “data producer”. Here are a few applications and services exposing OData feeds:

  • SharePoint 2010
  • SQL Azure
  • Windows Azure Table Storage
  • IBM Websphere

The complete list of currently available solutions is here: http://www.odata.org/producers. We clearly expect to see more OData producers coming for various platforms and languages.

How did we build the sample application?

You can watch the following Channel9 video with Claudio Caldato demoing and explaining the PHP sample. Claudio has been instrumental in driving the development of cross platform OData SDKs and building the OData community with Microsoft partners.

Get Microsoft Silverlight

Using the oData SDK for PHP to consume an OData feed is really quick and easy. You have to consider two main steps:

1. Generating the proxy classes: the SDK includes a tool that will read the definition of the OData Service and create the corresponding PHP proxy classes. It will create one class per collection that is exposed by the service. You can see here all the collection available in the Netflix service:
OData-netflix

2. The next step is to write the code for application logic. Your code will call the PHP proxy classes so that you can easily program against the OData.

The process is very similar with all the oData SDKs whether it is for PHP, Java, Objective C (iPhone & Mac), or JavaScript (AJAX and Palm WebOS). They all work the same way. To summarize, here’s the OData SDK for PHP architecture diagram which shows the key steps and elements:

Building-OData-PHP

Join the conversation

We’ve been working hard to get OData support on as many platforms as we can so a developer on any platform can both consume and produce these feeds. It’s only the beginning of the journey, and you can expect more to come. Of course, feedback is welcome!

To join the conversation, please visit www.odata.org.

Additional information to bookmark, two MIX10 sessions:

-- Jean-Christophe Cimetiere, Sr. Technical Evangelist