0
我在.NET中创建简单的演示REST Web服务,有两种方法可以在Web服务发送数据如何通过请求体传递请求值在REST Web服务
Through Query String
Through Request Body
我写了下面的代码我可以通过查询字符串
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "xml?id={id}")]
string XMLData(string id);
public string XMLData(string id)
{
return "You request id is " + id ;
}
使用Web服务,但我必须通过请求主体,而不是通过查询字符串传递ID值我。如何能做到这一点?