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