0
我創建了一個非常適合get的restful wcf服務。現在我建立了一些post方法。客戶端以JSON格式將數據發送到此服務。服務方法不會有任何參數,所以我需要從請求中讀取jsondata。我無法弄清楚我應該如何檢索從請求中獲得的數據。WCF Rest服務如何使用輸出參數訪問post JSON數據
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/SaveEmployee", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public bool SaveEmployee()
{
//Capture Employee Object Data here and perform save
return true;
}
[DataContract]
public class Employee
{
[DataMember]
public int Id
{
get;
set;
}
[DataMember]
public string Name
{
get;
set;
}
}