请求正文应该是什么样子?
我有一个 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
内容类型:application/json; 字符集=utf-8
我应该在正文中放入什么?
I have a WCF service with a method which looks like this (returns null for testing with the debugger, I care only about getting data in for now):
[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;
}
I am trying to make a request to that method using Fiddler, but can't get my head around on what the correct Request Body should be. I could change the Dictionary parameter to something else if that works better.
In Request Headers I pass:
User-Agent: Fiddler
Content-Type: application/json; charset=utf-8
What should I put in the body?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这就是你所追求的。
字典序列化为键值数组。
I think this is what you are after.
The dictionary serializes as a Key Value array.