Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to create a JSON restful webservice in ASP.NET C# that connect to MS SQL Database and retrieve stored procedures values from the database?. I have all stored procedures, data access layers and business layer available in my project. But I do not know how to create restful web service and how to call stored procedures values.

This webservice will eventually be used to communicate with iPhone SDK. And results of this web service will be shown in iPhone application. This iPhone application will be installed on iphone , and it will interact web service to get database values.

Any help would be appreciated.

Thanks!
Posted

Using .Net Framework 3.5 or above you can develop REST based Service. You may refer below links for more information on this.

http://msdn.microsoft.com/en-us/library/dd203052.aspx

http://msdn.microsoft.com/en-us/netframework/dd547388

http://msdn.microsoft.com/en-us/netframework/cc950529

For JSON and WCF REST Services.

http://dotnetninja.wordpress.com/2008/05/02/rest-service-with-wcf-and-json/

http://debugmode.net/2011/05/15/wcf-rest-service-with-josn-data/

However to develop REST Service, WCF support is not obligatory, you can develop REST Service even using simple HttpHandler or HttpModule.

Developing a REST Web Service using C# - A walkthrough

To call your SQL Server Stored Procedure you may use Ado.Net.

http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx
 
Share this answer
 
For communicating iphone with restful web service which uses json as data, the best library is restkit:

https://github.com/RestKit/RestKit[^]
 
Share this answer
 
Here's a pretty good walkthrough of creating your first JSON web service from scratch, loading and saving data from SQL Server, and even displaying it using JavaScript or on an iPhone:


[Creating a JSON Web Service]

I think that pretty much covers everything you were asking for !!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900