简体   繁体   English

如何从Fiddler提交对Wcf RESTful服务的“ WrappedRequest”请求

[英]how to PUT a “WrappedRequest” request for wcf RESTful service from Fiddler

I got the below REST service, I need to test it from fiddler, and I've searched alot, I figured how the payload is structured like the below: 我得到了以下REST服务,我需要从提琴手进行测试,并且进行了大量搜索,发现有效负载的结构如下:

<Update xmlns="http://tempuri.org/">
    <value></value>
</Update>

"value" can be XElement or IEnumerable<XElement> and nothing else. “值”可以是XElementIEnumerable<XElement> ,无其他。

the above XML is okay (means it hits a break point with empty pure object instance passed) but if I put "anything" inside node, I get 400 Bad Request without hitting any of my break points. 上面的XML是可以的(意味着它可以通过传递空的纯对象实例来达到断点),但是如果我在节点内放入“ anything”,我将得到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);
}

The question is how to create a proper xml to pass it to the service with Fiddler? 问题是如何创建一个适当的xml,以使用Fiddler将其传递给服务?

creating a template xml from the schema (if you are using any) used by your server-side component is a good start. 从服务器端组件使用的架构(如果使用任何架构)创建模板xml是一个好的开始。 other wise , you can compose a simple xml with all the attributes you are extracting at the Service(manual and error prone) 否则,您可以使用在服务处提取的所有属性组成一个简单的xml(手动且容易出错)

尝试BodyStyle = WebMessageBodyStyle.Bare

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM