【发布时间】:2013-01-15 16:16:00
【问题描述】:
我得到了以下 REST 服务,我需要从 fiddler 对其进行测试,并且我已经搜索了很多,我想出了有效负载的结构如下:
<Update xmlns="http://tempuri.org/">
<value></value>
</Update>
"value" 可以是XElement 或IEnumerable<XElement>,没有别的。
上面的 XML 没问题(意味着它在传递空纯对象实例的情况下到达断点)但是如果我将“任何东西”放在节点内,我会得到 400 Bad Request 而不会到达任何断点。
public interface ISomeInterface
{
[WebInvoke(Method = "PUT", UriTemplate = "/{key}", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void Update(string key, object value);
[WebInvoke(Method = "DELETE", UriTemplate = "/{key}")]
void Delete(string key);
}
public void Update(string key, object value)
{
this.UpdateSomething(key, value, true);
}
问题是如何创建一个合适的 xml 来使用 Fiddler 将其传递给服务?
【问题讨论】: