I have to make a rather complex system for my diploma work. Logically it will consist of the following components:
- Database
- Web-service
- Management with web interface
- Client iOS application that will consume web-service
I decided to implement all the first three components under .NET. Firstly I will create a database depending on the information load - this is clear. But then I need a web-service that will return data in JSON format for iOS clients to consume - that's obvious and not that hard to implement. For this I will use WCF technology.
Now I have a question, if I implement the web-service, how will I be able to respond to POST requests with JSON? It probably involves WCF JSON or something related? But I also need some web pages as admin part, so will this web-application be able to consume my centralized web-services as well or I should develop it separately? I just want my web service to act like a set of controllers.
There is a related question here but this doesn't quite reflect my question.
2 Answers 2
You can use ASP.NET MVC with an Json serializer library such as JSON.NET.
However, I would recommend to use ASP.NET Web API as it is specialized for these kinds of operations. ASP.NET Web API is a very simply and easy to use and learn framework for such purposes.
Of course, WCF is also an option though it is more complex and the learning curve is a bit higher.
-
If I decide to go with WCF for learning purposes, will this be a good decision? thanksVladimir Stazhilov– Vladimir Stazhilov11/21/2012 22:59:33Commented Nov 21, 2012 at 22:59
-
1Yes, though ASP.NET Web API is also worth learning. WCF is probably too large to learn entirely for just your use case.Sebazzz– Sebazzz11/22/2012 19:22:23Commented Nov 22, 2012 at 19:22
-
Thanks, I decided to go with ASP.NET MVC 4 Web API for my purposes! it's perfect for my caseVladimir Stazhilov– Vladimir Stazhilov11/25/2012 16:54:02Commented Nov 25, 2012 at 16:54
-
1Confusing :) ASP.NET Web API and ASP.NET MVC are clearly two seperate technologies. While you can build a web API with ASP.NET MVC, its like putting a nail in the wall with the wrong side of the hammer: It works, but ASP.NET Web API is specifically build for creating Web APIs.Sebazzz– Sebazzz11/25/2012 19:52:28Commented Nov 25, 2012 at 19:52
-
Well, that's exactly what I needed, I chose ASP MVC project with Web API template so that I have ApiControllers along with simple controllers :)Vladimir Stazhilov– Vladimir Stazhilov11/25/2012 22:13:28Commented Nov 25, 2012 at 22:13
I think .NET MVC with some controller actions returning JSON might be your best bet, as could deliver web app and the web service component with some nice RESTfull urls