我正在嘗試將一些json發佈到jboss服務。使用restSharp ..我的代碼如下。服務器無法識別json,使用restSharp發送請求
RestClient client = new RestClient(baseURL);
RestRequest authenticationrequest = new RestRequest();
authenticationrequest.RequestFormat = DataFormat.Json;
authenticationrequest.Method = Method.POST;
authenticationrequest.AddParameter("text/json", authenticationrequest.JsonSerializer.Serialize(prequestObj), ParameterType.RequestBody);
,也試過這一個
RestClient client = new RestClient(baseURL);
RestRequest authenticationrequest = new RestRequest();
authenticationrequest.RequestFormat = DataFormat.Json;
authenticationrequest.Method = Method.POST; authenticationrequest.AddBody(authenticationrequest.JsonSerializer.Serialize(prequestObj));
但在這兩種情況下,我的服務器是給我的錯誤JSON是格式不正確
沒有成功,當我檢查服務器日誌時,它沒有得到體內的json字符串。 – 2013-04-23 11:22:16
它是否給你同樣的錯誤? – user2309699 2013-04-23 11:26:41
是同樣的錯誤... – 2013-04-23 11:44:05