Last post May 09, 2014 01:59 AM by Fuxiang Zhang - MSFT
May 07, 2014 09:39 PM|anbujeremiah|LINK
to add/pass json type input parameter in Request body of REST WCF.
The input json type will be having around 40 fields,
Also this json type parameter comes via Xcode,Objective C Apps i.e, this Rest WCF will be consumed in apple mobile app.This json type needs to stored in database table.
via REST Client addon , we're unable to add Json type parameter in request body to check the working of service.
But the service added as service reference in asp.net application works also works when testing with WCF Client.
May 09, 2014 01:59 AM|Fuxiang Zhang - MSFT|LINK
Thank you post the issue to asp.net forum.
Based on what you described, I see you want to post json data to wcf rest service using HttpWebRequest.
For this issue, we should get our object converted to json string, then pass it to wcf rest service through HttpWebRequest like below.
string uri = string.Format(@"http://localhost:9001/AFMServer" + "/BuildItems");
var request = HttpWebRequest.Create(uri);
request.Method = "POST";
request.ContentType = "application/json; charset=utf-8";
//json type data
string json = JsonConvert.SerializeObject(item);
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
And there is a full example for this, please refer to it below.
Hope that helps, thanks.