**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Web.Services / System.Web.Services.Protocols / SoapException.cs
blob7ae6ca87b5af89d25707b583570d4740b1ec3865
1 //
2 // System.Web.Services.Protocols.SoapException.cs
3 //
4 // Author:
5 // Tim Coleman (tim@timcoleman.com)
6 // Lluis Sanchez Gual (lluis@novell.com)
7 //
8 // Copyright (C) Tim Coleman, 2002
9 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Xml;
34 namespace System.Web.Services.Protocols
36 [Serializable]
37 public class SoapException : SystemException
39 #region Fields
41 public static readonly XmlQualifiedName ClientFaultCode = new XmlQualifiedName ("Client", "http://schemas.xmlsoap.org/soap/envelope/");
42 public static readonly XmlQualifiedName DetailElementName = new XmlQualifiedName ("detail");
43 public static readonly XmlQualifiedName MustUnderstandFaultCode = new XmlQualifiedName ("MustUnderstand", "http://schemas.xmlsoap.org/soap/envelope/");
44 public static readonly XmlQualifiedName ServerFaultCode = new XmlQualifiedName ("Server", "http://schemas.xmlsoap.org/soap/envelope/");
45 public static readonly XmlQualifiedName VersionMismatchFaultCode = new XmlQualifiedName ("VersionMismatch", "http://schemas.xmlsoap.org/soap/envelope/");
47 string actor;
48 XmlQualifiedName code;
49 XmlNode detail;
51 #if NET_2_0
52 string lang;
53 string role;
54 SoapFaultSubcode subcode;
55 #endif
56 #endregion
58 #region Constructors
60 public SoapException (string message, XmlQualifiedName code)
61 : base (message)
63 this.code = code;
66 public SoapException (string message, XmlQualifiedName code, Exception innerException)
67 : base (message, innerException)
69 this.code = code;
72 public SoapException (string message, XmlQualifiedName code, string actor)
73 : base (message)
75 this.code = code;
76 this.actor = actor;
79 public SoapException (string message, XmlQualifiedName code, string actor, Exception innerException)
80 : base (message, innerException)
82 this.code = code;
83 this.actor = actor;
86 public SoapException (string message, XmlQualifiedName code, string actor, XmlNode detail)
87 : base (message)
89 this.code = code;
90 this.actor = actor;
91 this.detail = detail;
94 public SoapException (string message, XmlQualifiedName code, string actor, XmlNode detail, Exception innerException)
95 : base (message, innerException)
97 this.code = code;
98 this.actor = actor;
99 this.detail = detail;
102 #if NET_2_0
103 public SoapException (string message, XmlQualifiedName code, SoapFaultSubcode subcode)
104 : base (message)
106 this.code = code;
107 this.subcode = subcode;
110 public SoapException (string message, XmlQualifiedName code, string actor, string role, XmlNode detail, SoapFaultSubcode subcode, Exception innerException)
111 : base (message, innerException)
113 this.code = code;
114 this.subcode = subcode;
115 this.detail = detail;
116 this.actor = actor;
117 this.role = role;
120 public SoapException (string message, XmlQualifiedName code, string actor, string role, string lang, XmlNode detail, SoapFaultSubcode subcode, Exception innerException)
122 this.code = code;
123 this.subcode = subcode;
124 this.detail = detail;
125 this.actor = actor;
126 this.role = role;
127 this.lang = lang;
130 public static bool IsClientFaultCode (XmlQualifiedName code)
132 if (code == ClientFaultCode) return true;
133 if (code == Soap12FaultCodes.SenderFaultCode) return true;
134 return false;
137 public static bool IsMustUnderstandFaultCode (XmlQualifiedName code)
139 if (code == MustUnderstandFaultCode) return true;
140 if (code == Soap12FaultCodes.MustUnderstandFaultCode) return true;
141 return false;
144 public static bool IsServerFaultCode (XmlQualifiedName code)
146 if (code == ServerFaultCode) return true;
147 if (code == Soap12FaultCodes.ReceiverFaultCode) return true;
148 return false;
151 public static bool IsVersionMismatchFaultCode (XmlQualifiedName code)
153 if (code == VersionMismatchFaultCode) return true;
154 if (code == Soap12FaultCodes.VersionMismatchFaultCode) return true;
155 return false;
158 #endif
160 #endregion // Constructors
162 #region Properties
164 public string Actor {
165 get { return actor; }
168 public XmlQualifiedName Code {
169 get { return code; }
172 public XmlNode Detail {
173 get { return detail; }
176 #if NET_2_0
177 [System.Runtime.InteropServices.ComVisible(false)]
178 public string Lang {
179 get { return lang; }
182 [System.Runtime.InteropServices.ComVisible(false)]
183 public string Role {
184 get { return role; }
187 [System.Runtime.InteropServices.ComVisible(false)]
188 public SoapFaultSubcode Subcode {
189 get { return subcode; }
192 // Same value as actor
193 [System.Runtime.InteropServices.ComVisible(false)]
194 public string Node {
195 get { return actor; }
197 #endif
198 #endregion // Properties