treat DefaultWsdlHelpGenerator.jvm.aspx as DefaultWsdlHelpGenerator.aspx; correctly...
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Protocols / SoapHeader.cs
1 // 
2 // System.Web.Services.Protocols.SoapHeader.cs
3 //
4 // Author:
5 //   Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2002
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System.ComponentModel;
32 using System.Xml.Serialization;
33 using System.Xml;
34
35 namespace System.Web.Services.Protocols {
36         [SoapType (IncludeInSchema = false)]
37         [XmlType (IncludeInSchema = false)]
38         public abstract class SoapHeader {
39
40                 #region Fields
41
42                 string actor;
43                 bool didUnderstand;
44                 bool mustUnderstand;
45                 
46 #if NET_2_0
47                 string role;
48                 bool relay;
49 #endif
50
51                 #endregion // Fields
52
53                 #region Constructors
54
55                 protected SoapHeader ()
56                 {
57                         actor = String.Empty; 
58                         didUnderstand = false;
59                         mustUnderstand = false;
60                 }
61
62                 internal SoapHeader (XmlElement elem)
63                 {
64                         actor = elem.GetAttribute ("actor", WebServiceHelper.SoapEnvelopeNamespace);
65                         string me = elem.GetAttribute ("mustUnderstand", WebServiceHelper.SoapEnvelopeNamespace);
66                         if (me != "") EncodedMustUnderstand = me;
67 #if NET_2_0
68                         role = elem.GetAttribute ("role", WebServiceHelper.Soap12EnvelopeNamespace);
69                         me = elem.GetAttribute ("mustUnderstand", WebServiceHelper.Soap12EnvelopeNamespace);
70                         if (me != "") EncodedMustUnderstand12 = me;
71 #endif
72                 }
73
74                 #endregion // Constructors
75
76                 #region Properties
77
78                 [DefaultValue ("")]
79                 [SoapAttribute ("actor", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
80                 [XmlAttribute ("actor", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
81                 public string Actor {   
82                         get { return actor; }
83                         set { actor = value; }
84                 }
85
86                 [SoapIgnore]
87                 [XmlIgnore]
88                 public bool DidUnderstand {
89                         get { return didUnderstand; }
90                         set { didUnderstand = value; }
91                 }
92
93                 [DefaultValue ("0")]
94                 [SoapAttribute ("mustUnderstand", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
95                 [XmlAttribute ("mustUnderstand", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
96                 public string EncodedMustUnderstand {
97                         get { return (MustUnderstand ? "1" : "0"); }
98                         set {   
99                                 if (value == "true" || value == "1") 
100                                         MustUnderstand = true;
101                                 else if (value == "false" || value == "0")
102                                         MustUnderstand = false;
103                                 else
104                                         throw new ArgumentException ();
105                         }
106                 }
107
108                 [SoapIgnore]
109                 [XmlIgnore]
110                 public bool MustUnderstand {
111                         get { return mustUnderstand; }
112                         set { mustUnderstand = value; }
113                 }
114                 
115 #if NET_2_0
116
117                 [DefaultValue ("0")]
118                 [SoapAttribute ("mustUnderstand", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
119                 [XmlAttribute ("mustUnderstand", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
120                 [System.Runtime.InteropServices.ComVisible(false)]
121                 public string EncodedMustUnderstand12 {
122                         get { return (MustUnderstand ? "1" : "0"); }
123                         set {   
124                                 if (value == "true" || value == "1") 
125                                         MustUnderstand = true;
126                                 else if (value == "false" || value == "0")
127                                         MustUnderstand = false;
128                                 else
129                                         throw new ArgumentException ();
130                         }
131                 }
132
133                 [DefaultValue ("0")]
134                 [SoapAttribute ("relay", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
135                 [XmlAttribute ("relay", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
136                 [System.Runtime.InteropServices.ComVisible(false)]
137                 public string EncodedRelay
138                 {
139                         get { return (Relay ? "1" : "0"); }
140                         set {   
141                                 if (value == "true" || value == "1") 
142                                         Relay = true;
143                                 else if (value == "false" || value == "0")
144                                         Relay = false;
145                                 else
146                                         throw new ArgumentException ();
147                         }
148                 }
149                 
150                 [SoapIgnore]
151                 [XmlIgnore]
152                 [System.Runtime.InteropServices.ComVisible(false)]
153                 public bool Relay {
154                         get { return relay; }
155                         set { relay = value; }
156                 }
157                 
158                 [DefaultValue ("")]
159                 [SoapAttribute ("role", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
160                 [XmlAttribute ("role", Namespace = "http://www.w3.org/2003/05/soap-envelope")]
161                 [System.Runtime.InteropServices.ComVisible(false)]
162                 public string Role {
163                         get { return role; }
164                         set { role = value; }
165                 }
166                 
167 #endif
168
169                 #endregion // Properties
170         }
171 }