C# XmlSerializer属性在使用WCF的Web服务中无效
我使用WSCF.blue生成基于WSDL和xsd的web服务类。调用web服务时,我收到以下错误:C# XmlSerializer属性在使用WCF的Web服务中无效,c#,.net,wcf,web-services,soap,C#,.net,Wcf,Web Services,Soap,我使用WSCF.blue生成基于WSDL和xsd的web服务类。调用web服务时,我收到以下错误: “XmlSerializer属性System.Xml.Serialization.XmlAttributeAttribute在电子邮件中无效。当IsWrapped为true时,仅支持XmlElement、XmlArray、XmlArrayItem、XmlAnyAttribute和XmlAnyElement属性。” 我使用svcuti.exe得到了相同的结果。(VS 2010,.NET Framew
“XmlSerializer属性System.Xml.Serialization.XmlAttributeAttribute在电子邮件中无效。当IsWrapped为true时,仅支持XmlElement、XmlArray、XmlArrayItem、XmlAnyAttribute和XmlAnyElement属性。”
我使用svcuti.exe
得到了相同的结果。(VS 2010,.NET Framework 3.5)
有人听说过这个问题吗
使用WSDL.exe
(旧web服务.NET 2.0)生成代码会得到预期的结果,但返回值总是来自类型对象,其中WSCF.blue会给我一个特定的返回对象(例如ResponseProfileDto而不是object)
其中一个类定义如下所示:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="ResendEmailRequest", WrapperNamespace="http://xy.com/test", IsWrapped=true)]
public partial class ResendEmailRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "http://xy.com/test", Order = 0, Name = "Email")]
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Email;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "http://xy.com/test", Order = 1, Name = "LoginName")]
[System.Xml.Serialization.XmlAttributeAttribute()]
public string LoginName;
public ResendEmailRequest()
{
}
public ResendEmailRequest(string Email, string LoginName)
{
this.Email = Email;
this.LoginName = LoginName;
}
}
关于尝试使用
/wrapped
属性创建带有svcutil
的代码
希望这对.net中的核心命令有帮助:dotnetsvcuti--wrapped