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值我。如何能做到這一點?