申请机构应该如何?

Paw*_*iak 5 wcf json request fiddler

我有一个WCF服务,其方法看起来像这样(使用调试器返回null进行测试,我只关心现在获取数据):

[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "fares", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public List<Fare> GetFares(Dictionary<int, int> itineraries, decimal? threshold, bool includeInternational)
{
    return null;
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用Fiddler向该方法发出请求,但无法理解正确的Request Body应该是什么.如果效果更好,我可以将Dictionary参数更改为其他参数.

在请求标题我通过:

User-Agent:Fiddler
Content-Type:application/json; 字符集= utf-8的

我该怎么把身体放进去?

Mat*_*ser 7

我想这就是你所追求的.

{
"itineraries" : [{"Key":1,"Value":2},{"Key":2,"Value":3}],
"threshold" : 1.0,
"includeInternational" : true
}
Run Code Online (Sandbox Code Playgroud)

字典序列化为键值数组.