【发布时间】:2009-12-18 15:39:38
【问题描述】:
我有一个使用 xsd.exe 工具创建的对象,它在代码中定义了 xml 属性,但是来自我的 Web 服务的 SOAP 响应返回的是 xmlelements 而不是属性。
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class Accountinfo {
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string UpdatedDate;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string UpdatedBy;
... etc
如您所见,UpdatedDate 等被定义为属性。 当我调用我的服务时,我返回的皂体返回 Accountinfo 元素,如下所示:
<a:Accountinfo> <a:UpdatedBy>IGD</a:UpdatedBy> <a:UpdatedDate>12/18/2009 9:43:06 AM</a:UpdatedDate>...等
我要找的是<AccountInfo UpdatedBy="IGD" UpdatedDate="12/18/2009 9:43:06 AM" ... />
我没有太多使用 XML、SOAP 或 WCF 的经验,但我现在正在使用所有这三种方法,并且需要让它们正常工作。我在这里错过了什么?
【问题讨论】: