Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 请求主体应该是什么样子?_Wcf_Json_Request_Fiddler - Fatal编程技术网

Wcf 请求主体应该是什么样子?

Wcf 请求主体应该是什么样子?,wcf,json,request,fiddler,Wcf,Json,Request,Fiddler,我有一个WCF服务,其方法如下所示(使用调试器进行测试时返回null,我现在只关心获取数据): [运营合同] [WebInvoke(Method=“POST”,UriTemplate=“fares”,RequestFormat=WebMessageFormat.Json,ResponseFormat=WebMessageFormat.Json,BodyStyle=WebMessageBodyStyle.WrappedRequest)] 公共列表获取(字典行程、十进制阈值、bool include

我有一个WCF服务,其方法如下所示(使用调试器进行测试时返回null,我现在只关心获取数据):

[运营合同]
[WebInvoke(Method=“POST”,UriTemplate=“fares”,RequestFormat=WebMessageFormat.Json,ResponseFormat=WebMessageFormat.Json,BodyStyle=WebMessageBodyStyle.WrappedRequest)]
公共列表获取(字典行程、十进制阈值、bool includeInternational)
{
返回null;
}
我正试图使用Fiddler对该方法提出请求,但无法了解正确的请求主体应该是什么。如果效果更好,我可以将Dictionary参数更改为其他参数

在我传递的请求头中:

用户代理:Fiddler
内容类型:application/json;字符集=utf-8


我应该在身体里放些什么?

我想这就是你想要的

{
"itineraries" : [{"Key":1,"Value":2},{"Key":2,"Value":3}],
"threshold" : 1.0,
"includeInternational" : true
}

字典序列化为键值数组。

我在Fiddler中将其显式设置为POST请求,因此数据不会作为URI的一部分发送。问题是,在Fiddler中,我想手动键入数据,但不知道数据的外观,因此最终出现了服务器端异常。很抱歉,我误读了问题并更新了我的answe。我认为上面的json就是你想要的。如果仍然出现异常,请在web配置中打开system.diagnostics(如果尚未打开)。
{
"itineraries" : [{"Key":1,"Value":2},{"Key":2,"Value":3}],
"threshold" : 1.0,
"includeInternational" : true
}