mscorlib(4.0.0.0) API with additions
SoapMethodAttribute.cs
1 using System.Reflection;
3 using System.Security;
4 
6 {
8  [AttributeUsage(AttributeTargets.Method)]
9  [ComVisible(true)]
10  public sealed class SoapMethodAttribute : SoapAttribute
11  {
12  private string _SoapAction;
13 
14  private string _responseXmlElementName;
15 
16  private string _responseXmlNamespace;
17 
18  private string _returnXmlElementName;
19 
20  private bool _bSoapActionExplicitySet;
21 
22  internal bool SoapActionExplicitySet => _bSoapActionExplicitySet;
23 
26  public string SoapAction
27  {
28  [SecuritySafeCritical]
29  get
30  {
31  if (_SoapAction == null)
32  {
33  _SoapAction = XmlTypeNamespaceOfDeclaringType + "#" + ((MemberInfo)ReflectInfo).Name;
34  }
35  return _SoapAction;
36  }
37  set
38  {
39  _SoapAction = value;
40  _bSoapActionExplicitySet = true;
41  }
42  }
43 
47  public override bool UseAttribute
48  {
49  get
50  {
51  return false;
52  }
53  set
54  {
55  throw new RemotingException(Environment.GetResourceString("Remoting_Attribute_UseAttributeNotsettable"));
56  }
57  }
58 
61  public override string XmlNamespace
62  {
63  [SecuritySafeCritical]
64  get
65  {
66  if (ProtXmlNamespace == null)
67  {
68  ProtXmlNamespace = XmlTypeNamespaceOfDeclaringType;
69  }
70  return ProtXmlNamespace;
71  }
72  set
73  {
74  ProtXmlNamespace = value;
75  }
76  }
77 
80  public string ResponseXmlElementName
81  {
82  get
83  {
84  if (_responseXmlElementName == null && ReflectInfo != null)
85  {
86  _responseXmlElementName = ((MemberInfo)ReflectInfo).Name + "Response";
87  }
88  return _responseXmlElementName;
89  }
90  set
91  {
92  _responseXmlElementName = value;
93  }
94  }
95 
98  public string ResponseXmlNamespace
99  {
100  get
101  {
102  if (_responseXmlNamespace == null)
103  {
104  _responseXmlNamespace = XmlNamespace;
105  }
106  return _responseXmlNamespace;
107  }
108  set
109  {
110  _responseXmlNamespace = value;
111  }
112  }
113 
116  public string ReturnXmlElementName
117  {
118  get
119  {
120  if (_returnXmlElementName == null)
121  {
122  _returnXmlElementName = "return";
123  }
124  return _returnXmlElementName;
125  }
126  set
127  {
128  _returnXmlElementName = value;
129  }
130  }
131 
132  private string XmlTypeNamespaceOfDeclaringType
133  {
134  [SecurityCritical]
135  get
136  {
137  if (ReflectInfo != null)
138  {
139  Type declaringType = ((MemberInfo)ReflectInfo).DeclaringType;
140  return XmlNamespaceEncoder.GetXmlNamespaceForType((RuntimeType)declaringType, null);
141  }
142  return null;
143  }
144  }
145  }
146 }
Obtains information about the attributes of a member and provides access to member metadata.
Definition: MemberInfo.cs:14
string ReturnXmlElementName
Gets or sets the XML element name used for the return value from the target method.
object ReflectInfo
A reflection object used by attribute classes derived from the T:System.Runtime.Remoting....
string SoapAction
Gets or sets the SOAPAction header field used with HTTP requests sent with this method....
string ResponseXmlElementName
Gets or sets the XML element name to use for the method response to the target method.
Definition: __Canon.cs:3
string ResponseXmlNamespace
Gets or sets the XML element namesapce used for method response to the target method.
override Type DeclaringType
Gets the type that declares the current nested type or generic type parameter.
Definition: Type.cs:54
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
override bool UseAttribute
Gets or sets a value indicating whether the target of the current attribute will be serialized as an ...
override string XmlNamespace
Gets or sets the XML namespace that is used during serialization of remote method calls of the target...
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
AttributeTargets
Specifies the application elements on which it is valid to apply an attribute.
string ProtXmlNamespace
The XML namespace to which the target of the current SOAP attribute is serialized.
Customizes SOAP generation and processing for a method. This class cannot be inherited.
Provides default functionality for all SOAP attributes.
Definition: SoapAttribute.cs:7
The exception that is thrown when something has gone wrong during remoting.