I am creating iphone appli开发者_如何学Pythoncation which will require data from .NET web services.
I want to ask which type of web service is better for iphone (soap or restful)?
And my .Net project is built in mvc ...what type of web services are created for MVC.project.
Thanks
SOAP is too heavy for mobile - it will unnecessarily slow down your application with no added value.
Create a RESTful service instead.
If you want to make it part of your MVC application, then you will want to create a new controller and view, have it accept the parameters you need to identify the data you'd like returned, then use the "JSONResult" type to return JSON data.
I highly recommend you watch this video from www.asp.net. It demonstrates almost exactly what you want to do. The only difference is that instead of calling the controller from another page in your applicaiton, simply call it from your iPhone app.
http://www.asp.net/mvc/videos/how-do-i-return-json-formatted-data-for-an-ajax-call-in-an-aspnet-mvc-web-application <>
精彩评论