How to call ASP.Net Web API service from Android?

In my previous posts, I discussed how we can consume the ASP.Net Web API with RestSharp and HttpClient. In this small one, I would like to show how we can make a demo application in Android consuming ASP.Net Web API service. To save time, I already prepare a sample REST web service made by ASP.NET Web API with only one resource at http://restwebserviceforandroid.apphb.com/api/products. You can access the service without any authentication for your testing purposes. On the server, I use Entity Framework to connect to a SQL Server behind with following structure

Continue reading How to call ASP.Net Web API service from Android?

How to consume ASP.NET Web API RC with HttpClient?

In previous post I discussed How to consume ASP.NET Web API RC with RestSharp?. RestSharp seems to be a good candidate for working with REST service but during development I found out a problem that RestSharp doesn’t handle enum type very well and I got always null object by posting object to web service. The reason is because ASP.NET Web API serializes enumerated type to integer and RestSharp can only deserialize enumerated type under string format. As consequence you could notice in previous post, the Category property of Product is a kind of enumerate ProductCategories but I have to define it as int so that the serialization works.

Continue reading How to consume ASP.NET Web API RC with HttpClient?

How to consume ASP.NET Web API RC with RestSharp?

As I mentioned in my blog before that ASP.NET Web API will be the next generation of WCF for creating RESTful web service which can be consumed by any platforms or devices supporting HTTP protocol. It is a part of ASP.NET MVC 4 , can be installed on Visual Studio 2010 or Visual Studio 2012 and is currently on Release Candidate version. It’s first time that I try a RC product in my software and I had really a lot of troubles:
– There are breaking changes from Beta version to RC version which causes a lot of things not work anymore.
– The Castle Windsor (an Inversion of Control container) runs unstably with ASP.NET Web Server because of his error “Could not load file or assembly…” and I do have to stop debugging, stop ASP.NET Web Server and start again each time when an exception was thrown or when I stop debugging at any position in source code.
– The Inversion of Control container must be attached with new code when changing from Beta version to RC version.
– Lack of documentation.

Continue reading How to consume ASP.NET Web API RC with RestSharp?