代码之家  ›  专栏  ›  技术社区  ›  Pawel Krakowiak

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

  •  5
  • Pawel Krakowiak  · 技术社区  · 16 年前

    我有一个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;
    }
    

    我正试图使用Fiddler对该方法提出请求,但无法了解正确的请求主体应该是什么。如果效果更好,我可以将Dictionary参数更改为其他参数。

    用户代理:Fiddler

    1 回复  |  直到 16 年前
        1
  •  7
  •   Oded    13 年前

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

    字典序列化为键值数组。