Floating FB popout byF5debug

101 How to on Windows Phone – How to #46 – Consume Odata Service in Windows Phone

 

In this article we are going to see how to consume a OData Service in a Windows Phone application, OData is is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. ODATA service allows the consumers to query the data over the http protocol and retrieve the result in a plain XML format. Normally a mobile application development requires data that are available as a service which can be consumed and use on demand, where the ODATA Service plays a major role. We have variety of ODATA services that are available in market, rather we can create our ODATA service which can also be consumes as a WCF Data Services.  Let us see the step by step process on how to consume the ODATA Service in our Windows Phone application and see how to make use of it efficiently.

Open Visual Studio 2010 IDE in administrator mode and create a new project for Windows Phone with a valid project name as shown in the screen below.

image

Now we need to design our XAML page where we want to show our consumed ODATA service, we can use any of the listing control to display the data as per our requirement. Let us concentrate on how to consume the OData rather concentrating on how to display the data. Let us try to consume the service of the Telerik Video, as the ODATA service is available using the URI http://tv.telerik.com/services/odata.svc/. To add the ODATA service right click on the project name and select Add Service Reference as shown in the screen below.

image

Let us provide the OATA Service uri and click on Go button to discover the service online. Once the service is discovered we need to change the namespace to a user defined name as ODataTelerik as shown in the screen below.

image

On successfully adding the ODATA service reference to the project we can see a list of files added to the service reference folder. Now we are ready with the service, our next step is write some code that will do the necessary process to get the data from the service and show it to the user interface which we designed. Add the below 2 namespaces which are required to consume and get the data from the ODATA service as shown in the screen below.

using System.Data.Services.Client;
using F5debugHowTo46.ODataTelerik

Once we added the above 2 namespaces we need to start with our code to consume the service and use is across to get the data and showcase in any format that takes care of the requirement.

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter