I am creating an iOS application that I need to connect to a database through a web service. I only know basic knowledge about using RESTful web services, I have never written my own before and was wondering if you can give me any advice on where I can find out how to write my own RESTful web service.
In my iOS program I will be sending a part number to the web service the web service will then need to return color and size information on the part. I’m not sure if XML is the best format or is there something better?
I guess my question is twofold here:
- Is this something I should be doing with a RESTful web service?
- Where can I find tutorials on creating a .NET-based RESTful web service?
My advice would be to implement this using ASP.NET MVC3 – as this provides a nice controller-action paradigm which is excellent for implementing a REST service. You could use WCF, and I am sure it would work fine, but from personal experience I found MVC3 to be very easy to use to write a REST back-end for an iOS client.
I would recommend using JSON and not XML, primarily as it is more concise than XML, but it has other advantages should you decide later to implement a web front end for your database, as Javascript has good support for JSON.
There are a number of JSON libraries for iOS, including SBJSON and YAJL
There is also a well regarded framework for iOS REST implementations called RestKit.
As for tutorials for implementing REST using the MVC famework, this might be one to look at.