我想将Web请求中的数据Json以json格式发送到Web服务,并从服务器获取结果。很多方法..:p
请帮我找一个解决方案。
答案 0 :(得分:0)
您可以使用(例如)RestClient ftom restsharp
_restClient = new RestClient();
var request = new RestRequest(url) { Method = Method.POST };
request.AddHeader("content-type", "application/json");
request.RequestFormat = DataFormat.Json;
request.AddParameter("json", YOUR_JSON, ParameterType.GetOrPost);
request.Timeout = DEFAULT_TIMEOUT;
_restClient.Timeout = Constants.DEFAULT_TIMEOUT;
_restClient.ExecuteAsync(request, response =>
{
// check response here
});