WebServicesSection.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. //
  2. // System.Web.Services.Configuration.WebServicesSection
  3. //
  4. // Authors:
  5. // Chris Toshok ([email protected])
  6. //
  7. // (C) 2005 Novell, Inc (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System;
  31. using System.Configuration;
  32. using System.Web.Configuration;
  33. namespace System.Web.Services.Configuration
  34. {
  35. public sealed class WebServicesSection : ConfigurationSection
  36. {
  37. static ConfigurationProperty conformanceWarningsProp;
  38. static ConfigurationProperty protocolsProp;
  39. static ConfigurationProperty serviceDescriptionFormatExtensionTypesProp;
  40. static ConfigurationProperty soapEnvelopeProcessingProp;
  41. static ConfigurationProperty soapExtensionImporterTypesProp;
  42. static ConfigurationProperty soapExtensionReflectorTypesProp;
  43. static ConfigurationProperty soapExtensionTypesProp;
  44. static ConfigurationProperty soapServerProtocolFactoryProp;
  45. static ConfigurationProperty soapTransportImporterTypesProp;
  46. static ConfigurationProperty wsdlHelpGeneratorProp;
  47. static ConfigurationPropertyCollection properties;
  48. static WebServicesSection ()
  49. {
  50. conformanceWarningsProp = new ConfigurationProperty ("conformanceWarnings", typeof (WsiProfilesElementCollection));
  51. protocolsProp = new ConfigurationProperty ("protocols", typeof (ProtocolElementCollection));
  52. serviceDescriptionFormatExtensionTypesProp = new ConfigurationProperty ("serviceDescriptionFormatExtensionTypes", typeof (TypeElementCollection));
  53. soapEnvelopeProcessingProp = new ConfigurationProperty ("soapEnvelopeProcessing", typeof (SoapEnvelopeProcessingElement));
  54. soapExtensionImporterTypesProp = new ConfigurationProperty ("soapExtensionImporterTypes", typeof (TypeElementCollection));
  55. soapExtensionReflectorTypesProp = new ConfigurationProperty ("soapExtensionReflectorTypes", typeof (TypeElementCollection));
  56. soapExtensionTypesProp = new ConfigurationProperty ("soapExtensionTypes", typeof (SoapExtensionTypeElementCollection));
  57. soapServerProtocolFactoryProp = new ConfigurationProperty ("soapServerProtocolFactory", typeof (TypeElement));
  58. soapTransportImporterTypesProp = new ConfigurationProperty ("soapTransportImporterTypes", typeof (TypeElementCollection));
  59. wsdlHelpGeneratorProp = new ConfigurationProperty ("wsdlHelpGenerator", typeof (WsdlHelpGeneratorElement));
  60. properties = new ConfigurationPropertyCollection ();
  61. properties.Add (conformanceWarningsProp);
  62. properties.Add (protocolsProp);
  63. properties.Add (serviceDescriptionFormatExtensionTypesProp);
  64. properties.Add (soapEnvelopeProcessingProp);
  65. properties.Add (soapExtensionImporterTypesProp);
  66. properties.Add (soapExtensionReflectorTypesProp);
  67. properties.Add (soapExtensionTypesProp);
  68. properties.Add (soapServerProtocolFactoryProp);
  69. properties.Add (soapTransportImporterTypesProp);
  70. properties.Add (wsdlHelpGeneratorProp);
  71. }
  72. public WebServicesSection GetSection (System.Configuration.Configuration config)
  73. {
  74. return (WebServicesSection)config.GetSection ("webServices");
  75. }
  76. protected override void InitializeDefault ()
  77. {
  78. }
  79. protected override void Reset (ConfigurationElement parentElement)
  80. {
  81. base.Reset (parentElement);
  82. }
  83. [ConfigurationProperty ("conformanceWarnings")]
  84. public WsiProfilesElementCollection ConformanceWarnings {
  85. get { return (WsiProfilesElementCollection) base [conformanceWarningsProp];}
  86. }
  87. [MonoTODO]
  88. public WebServicesSection Current {
  89. get { throw new NotImplementedException (); }
  90. }
  91. [MonoTODO]
  92. public DiagnosticsElement Diagnostics {
  93. get { throw new NotImplementedException (); }
  94. set { throw new NotImplementedException (); }
  95. }
  96. [MonoTODO]
  97. public WebServiceProtocols EnabledProtocols {
  98. get { throw new NotImplementedException (); }
  99. }
  100. [ConfigurationProperty ("protocols")]
  101. public ProtocolElementCollection Protocols {
  102. get { return (ProtocolElementCollection) base [protocolsProp];}
  103. }
  104. [ConfigurationProperty ("serviceDescriptionFormatExtensionTypes")]
  105. public TypeElementCollection ServiceDescriptionFormatExtensionTypes {
  106. get { return (TypeElementCollection) base [serviceDescriptionFormatExtensionTypesProp];}
  107. }
  108. [ConfigurationProperty ("soapEnvelopeProcessing")]
  109. public SoapEnvelopeProcessingElement SoapEnvelopeProcessing {
  110. get { return (SoapEnvelopeProcessingElement) base [soapEnvelopeProcessingProp];}
  111. set { base[soapEnvelopeProcessingProp] = value; }
  112. }
  113. [ConfigurationProperty ("soapExtensionImporterTypes")]
  114. public TypeElementCollection SoapExtensionImporterTypes {
  115. get { return (TypeElementCollection) base [soapExtensionImporterTypesProp];}
  116. }
  117. [ConfigurationProperty ("soapExtensionReflectorTypes")]
  118. public TypeElementCollection SoapExtensionReflectorTypes {
  119. get { return (TypeElementCollection) base [soapExtensionReflectorTypesProp];}
  120. }
  121. [ConfigurationProperty ("soapExtensionTypes")]
  122. public SoapExtensionTypeElementCollection SoapExtensionTypes {
  123. get { return (SoapExtensionTypeElementCollection) base [soapExtensionTypesProp];}
  124. }
  125. [ConfigurationProperty ("soapServerProtocolFactory")]
  126. public TypeElement SoapServerProtocolFactoryType {
  127. get { return (TypeElement) base [soapServerProtocolFactoryProp];}
  128. }
  129. [ConfigurationProperty("soapTransportImporterTypes")]
  130. public TypeElementCollection SoapTransportImporterTypes {
  131. get { return (TypeElementCollection) base [soapTransportImporterTypesProp];}
  132. }
  133. [ConfigurationProperty ("wsdlHelpGenerator")]
  134. public WsdlHelpGeneratorElement WsdlHelpGenerator {
  135. get { return (WsdlHelpGeneratorElement) base [wsdlHelpGeneratorProp];}
  136. }
  137. protected override ConfigurationPropertyCollection Properties {
  138. get { return properties; }
  139. }
  140. internal static WebServicesSection Instance {
  141. get { return (WebServicesSection)WebConfigurationManager.GetWebApplicationSection ("system.web/webServices"); }
  142. }
  143. internal static bool IsSupported (WebServiceProtocols proto)
  144. {
  145. return ((Instance.EnabledProtocols & proto) == proto && (proto != 0));
  146. }
  147. }
  148. }
  149. #endif