0
这里是Put调用(注:我也做过这种传统的非Microsoft API方式,同样的结果)。HTTP PUT期间对象上的数据丢失
response = httpClient.Put(uriTemplate, contentType, CreateContentFromObject(obj));
然后我调试到这最终得到以下服务:
这是我的目标
[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,没有问题......