2012-07-02 43 views
0

您是否需要在iOS中使用WCF服務上的POST方法創建相同的對象?在WCF服務的POST調用的使用iOS 5如何使用Json將對象發佈到WCF服務

[OperationContract] 
    [WebInvoke(Method = "POST", 
     ResponseFormat = WebMessageFormat.Json, 
     RequestFormat = WebMessageFormat.Json, 
     BodyStyle = WebMessageBodyStyle.Wrapped, 
     UriTemplate = "")] 
     //method 
     Employee PostEmp(Employee emp); 
[DataContract] 
public class Employee 
{ 
    [DataMember] 
    public string firstname { get; set; } 
    [DataMember] 
    public string idkey { get; set; } 
    [DataMember] 
    public string lastname { get; set; } 
    [DataMember] 
    public string salary { get; set; } 

    public Employee(string first, string id, string sal, string last) 
    { 
     firstname = first; 
     idkey = id; 
     salary = sal; 
     lastname = last; 

    } 

回答

0

不,你沒有創建iOS上的POCO類。 iOS只會從WCF服務讀取Json字符串響應。 iOS設備還會將Json發佈到服務網址。

wcf服務將爲您執行所有序列化/反序列化。

相關問題