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;
}
}