我正在使用由 wsdl.exe 生成的示例 SOAP 代码。对象lastError
声明如下:
private Exception lastError;
Visual Studio 在此行上生成错误
String msg = lastError.Message;
说
'Exception' does not contain a definition for 'Message' and no extension method 'Message' accepting a first argument of type 'Exception' could be found (are you missing a using directive or an assembly reference?)
:
Exception
wsdl.exe 生成的类如下所示:
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(NestedException))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PersistenceException))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(BbSecurityException))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://gradebook.ws.blackboard")]
public partial class Exception {
private object exception1Field;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Exception", IsNullable=true)]
public object Exception1 {
get {
return this.exception1Field;
}
set {
this.exception1Field = value;
}
}
}