走投无路了,贴:C#根据WSDL生成代理类后,WSDL中的EXCEPTION无法解析
走投无路了,求救贴:C#根据WSDL生成代理类后,WSDL中的EXCEPTION无法解析
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CreditException))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://service.credit.nongxintong.com")]
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;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://commons.nongxintong.com/xsd")]
public partial class CreditException : Exception {
private string messageField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string message {
get {
return this.messageField;
}
set {
this.messageField = value;
}
}
}
提示错误:Error 1 The type 'Exception' already contains a definition for 'exception1Field' E:\vsworkspace\nongxintong_manager\nongxintong_manager\webservice\creditService.cs 538 20 nongxintong_manager
------解决思路----------------------
Exception是C#关键字, 不能用于自定义的类名。
你手工换个名字试试。
------解决思路----------------------
不是随便什么类型(父类)都可以用的,许多类型不能用。你必须自己定义一个Exception父类,例如写
然后从你自己的 Exception 上继承。
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CreditException))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://service.credit.nongxintong.com")]
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;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://commons.nongxintong.com/xsd")]
public partial class CreditException : Exception {
private string messageField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string message {
get {
return this.messageField;
}
set {
this.messageField = value;
}
}
}
提示错误:Error 1 The type 'Exception' already contains a definition for 'exception1Field' E:\vsworkspace\nongxintong_manager\nongxintong_manager\webservice\creditService.cs 538 20 nongxintong_manager
------解决思路----------------------
Exception是C#关键字, 不能用于自定义的类名。
你手工换个名字试试。
------解决思路----------------------
不是随便什么类型(父类)都可以用的,许多类型不能用。你必须自己定义一个Exception父类,例如写
namespace MyModels
public class Exception
{
public string Message;
}
.....
然后从你自己的 Exception 上继承。