Can someone please tell me what is the best way to create web service that sends JSON to MS SQL server.(php or .net POST web service?) I want to host the web service on IIS if possible.Links of tutorials will be very useful. Many Thanks.
Asked
Active
Viewed 562 times
2 Answers
0
I would recommend using ASP.NET Web API it supports both JSON and XML out of the box and the development is relatively easy as you don't have to manage the parsing of JSON data to and from C# objects, you can then just use Entity Framework to communicate with the database.
Start with : http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations
And: http://www.entityframeworktutorial.net/EntityFramework4.3/Introduction.aspx I think this is a bit out dated but the core will remain the same

Armand
- 9,847
- 9
- 42
- 75
0
//Create the request
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"your script name.php"]];
// create the Method "GET" or "POST"
[request setHTTPMethod:@"POST"];
//Pass The String to server
NSString *userUpdate =[NSString stringWithFormat:@"artist_email=%@ ",your string Name,nil];
//Check The Value what we passed
NSLog(@"the data Details is =%@", userUpdate);
//Convert the String to Data
NSData *data1 = [userUpdate dataUsingEncoding:NSUTF8StringEncoding];
//Apply the data to the body
[request setHTTPBody:data1];
//Create the response and Error
NSError *err;
NSURLResponse *response;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSString *resSrt = [[NSString alloc]initWithData:responseData encoding:NSASCIIStringEncoding];
//This is for Response
NSLog(@"got response==%@", resSrt);
if(resSrt)
{
NSLog(@"got response");
}
else
{
NSLog(@"faield to connect");
}

Anbu.Karthik
- 82,064
- 23
- 174
- 143