2012-03-15 62 views
0

這裏是Put調用(注:我也做過這種傳統的非Microsoft API方式,同樣的結果)。HTTP PUT期間對象上的數據丟失

response = httpClient.Put(uriTemplate, contentType, CreateContentFromObject(obj)); 

然後我調試到這最終得到以下服務: enter image description here

這是我的目標

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.Xml.Serialization.XmlTypeAttribute(TypeName = "Dog", AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/DowCorning.BusinessObjects")] 
[System.Xml.Serialization.XmlRootAttribute(DataType = "Dog", Namespace = "http://schemas.datacontract.org/2004/07/DowCorning.BusinessObjects", IsNullable = false)] 
public class Dog 
{ 
    public string FurColor { get; set; } 
    public int Weight { get; set; } 
    public string Temperment { get; set; } 
    public string Tricks { get; set; } 
    public string Breed { get; set; } 
} 

這裏是我的合同

 [OperationContract(Name = "http://www.company.com/dog")] 
    [WebInvoke(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "dog", Method = "PUT")] 
    Dog Doggy(Dog updateDog); 

任何幫助在弄清楚爲什麼數據丟失發生將是gr吃得津津樂道。

注:如果我執行通過小提琴手的PUT,沒有問題......

回答

0

這是一個系列化問題

我利用我的數據成員的[訂購]屬性,這解決了我的問題。