seb*_*ibu 2 wcf post json fiddler
我有一个暴露休息端点的wcf服务.我想用fiddler来测试它.我有这样的方法:
[WebInvoke(Method = "POST", UriTemplate = "EditContact", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
string EditContact(string idContact, Contact Contact);
Run Code Online (Sandbox Code Playgroud)
我输入:
POST http://192.168.1.31/ContactLibrary2.0/Service.svc/rest/DeleteContact HTTP/1.1
User-Agent: Fiddler
Host: 192.168.1.31
Content-Type : application/json; Charset=UTF-8
{
"idContact":"67697",
"firstName":"6767",
"lastName":"afdgsg",
"email":"dfghdfdb",
"age":"120",
"street":"sdf",
"city":"dfghgfhjhdfgsdv",
"country":"sdfsd"
}
Run Code Online (Sandbox Code Playgroud)
从我的项目中可以看到更多代码:HERE
我收到http 400错误(错误的请求错误).想法?
您的请求应如下所示:
POST http://192.168.1.31/ContactLibrary2.0/Service.svc/rest/DeleteContact HTTP/1.1
User-Agent: Fiddler
Content-Type: application/json
{
"idContact":5,
"Contact":{
"idContact":"67697",
"firstName":"6767",
"lastName":"afdgsg",
"email":"dfghdfdb",
"age":"120",
"street":"sdf",
"city":"dfghgfhjhdfgsdv",
"country":"sdfsd"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6189 次 |
| 最近记录: |