2 // System.Web.Services.Configuration.WebServicesSection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
34 using System
.Configuration
;
35 using System
.Web
.Configuration
;
37 namespace System
.Web
.Services
.Configuration
39 public sealed class WebServicesSection
: ConfigurationSection
41 static ConfigurationProperty conformanceWarningsProp
;
42 static ConfigurationProperty diagnosticsProp
;
43 static ConfigurationProperty protocolsProp
;
44 static ConfigurationProperty serviceDescriptionFormatExtensionTypesProp
;
45 static ConfigurationProperty soapEnvelopeProcessingProp
;
46 static ConfigurationProperty soapExtensionImporterTypesProp
;
47 static ConfigurationProperty soapExtensionReflectorTypesProp
;
48 static ConfigurationProperty soapExtensionTypesProp
;
49 static ConfigurationProperty soapServerProtocolFactoryProp
;
50 static ConfigurationProperty soapTransportImporterTypesProp
;
51 static ConfigurationProperty wsdlHelpGeneratorProp
;
52 static ConfigurationPropertyCollection properties
;
54 static WebServicesSection ()
56 conformanceWarningsProp
= new ConfigurationProperty ("conformanceWarnings", typeof (WsiProfilesElementCollection
), null,
57 null, null, ConfigurationPropertyOptions
.None
);
58 diagnosticsProp
= new ConfigurationProperty ("diagnostics", typeof (DiagnosticsElement
), null,
59 null, null, ConfigurationPropertyOptions
.None
);
60 protocolsProp
= new ConfigurationProperty ("protocols", typeof (ProtocolElementCollection
), null,
61 null, null, ConfigurationPropertyOptions
.None
);
62 serviceDescriptionFormatExtensionTypesProp
= new ConfigurationProperty ("serviceDescriptionFormatExtensionTypes", typeof (TypeElementCollection
), null,
63 null, null, ConfigurationPropertyOptions
.None
);
64 soapEnvelopeProcessingProp
= new ConfigurationProperty ("soapEnvelopeProcessing", typeof (SoapEnvelopeProcessingElement
), null,
65 null, null, ConfigurationPropertyOptions
.None
);
66 soapExtensionImporterTypesProp
= new ConfigurationProperty ("soapExtensionImporterTypes", typeof (TypeElementCollection
), null,
67 null, null, ConfigurationPropertyOptions
.None
);
68 soapExtensionReflectorTypesProp
= new ConfigurationProperty ("soapExtensionReflectorTypes", typeof (TypeElementCollection
), null,
69 null, null, ConfigurationPropertyOptions
.None
);
70 soapExtensionTypesProp
= new ConfigurationProperty ("soapExtensionTypes", typeof (SoapExtensionTypeElementCollection
), null,
71 null, null, ConfigurationPropertyOptions
.None
);
72 soapServerProtocolFactoryProp
= new ConfigurationProperty ("soapServerProtocolFactory", typeof (TypeElement
), null,
73 null, null, ConfigurationPropertyOptions
.None
);
74 soapTransportImporterTypesProp
= new ConfigurationProperty ("soapTransportImporterTypes", typeof (TypeElementCollection
), null,
75 null, null, ConfigurationPropertyOptions
.None
);
76 wsdlHelpGeneratorProp
= new ConfigurationProperty ("wsdlHelpGenerator", typeof (WsdlHelpGeneratorElement
), null,
77 null, null, ConfigurationPropertyOptions
.None
);
78 properties
= new ConfigurationPropertyCollection ();
80 properties
.Add (conformanceWarningsProp
);
81 properties
.Add (diagnosticsProp
);
82 properties
.Add (protocolsProp
);
83 properties
.Add (serviceDescriptionFormatExtensionTypesProp
);
84 properties
.Add (soapEnvelopeProcessingProp
);
85 properties
.Add (soapExtensionImporterTypesProp
);
86 properties
.Add (soapExtensionReflectorTypesProp
);
87 properties
.Add (soapExtensionTypesProp
);
88 properties
.Add (soapServerProtocolFactoryProp
);
89 properties
.Add (soapTransportImporterTypesProp
);
90 properties
.Add (wsdlHelpGeneratorProp
);
94 public static WebServicesSection
GetSection (System
.Configuration
.Configuration config
)
96 return (WebServicesSection
) config
.GetSection ("webServices");
99 protected override void InitializeDefault ()
103 protected override void Reset (ConfigurationElement parentElement
)
105 base.Reset (parentElement
);
108 [ConfigurationProperty ("conformanceWarnings")]
109 public WsiProfilesElementCollection ConformanceWarnings
{
110 get { return (WsiProfilesElementCollection) base [conformanceWarningsProp];}
113 public DiagnosticsElement Diagnostics
{
114 get { return (DiagnosticsElement) base [diagnosticsProp]; }
115 set { base[diagnosticsProp] = value; }
119 WebServiceProtocols enabledProtocols
= WebServiceProtocols
.Unknown
;
120 public WebServiceProtocols EnabledProtocols
{
122 if (enabledProtocols
== WebServiceProtocols
.Unknown
) {
123 foreach (ProtocolElement el
in Protocols
)
124 enabledProtocols
|= el
.Name
;
127 return enabledProtocols
;
131 [ConfigurationProperty ("protocols")]
132 public ProtocolElementCollection Protocols
{
133 get { return (ProtocolElementCollection) base [protocolsProp];}
136 [ConfigurationProperty ("serviceDescriptionFormatExtensionTypes")]
137 public TypeElementCollection ServiceDescriptionFormatExtensionTypes
{
138 get { return (TypeElementCollection) base [serviceDescriptionFormatExtensionTypesProp];}
141 [ConfigurationProperty ("soapEnvelopeProcessing")]
142 public SoapEnvelopeProcessingElement SoapEnvelopeProcessing
{
143 get { return (SoapEnvelopeProcessingElement) base [soapEnvelopeProcessingProp];}
144 set { base[soapEnvelopeProcessingProp] = value; }
147 [ConfigurationProperty ("soapExtensionImporterTypes")]
148 public TypeElementCollection SoapExtensionImporterTypes
{
149 get { return (TypeElementCollection) base [soapExtensionImporterTypesProp];}
152 [ConfigurationProperty ("soapExtensionReflectorTypes")]
153 public TypeElementCollection SoapExtensionReflectorTypes
{
154 get { return (TypeElementCollection) base [soapExtensionReflectorTypesProp];}
157 [ConfigurationProperty ("soapExtensionTypes")]
158 public SoapExtensionTypeElementCollection SoapExtensionTypes
{
159 get { return (SoapExtensionTypeElementCollection) base [soapExtensionTypesProp];}
162 [ConfigurationProperty ("soapServerProtocolFactory")]
163 public TypeElement SoapServerProtocolFactoryType
{
164 get { return (TypeElement) base [soapServerProtocolFactoryProp];}
167 [ConfigurationProperty("soapTransportImporterTypes")]
168 public TypeElementCollection SoapTransportImporterTypes
{
169 get { return (TypeElementCollection) base [soapTransportImporterTypesProp];}
172 [ConfigurationProperty ("wsdlHelpGenerator")]
173 public WsdlHelpGeneratorElement WsdlHelpGenerator
{
174 get { return (WsdlHelpGeneratorElement) base [wsdlHelpGeneratorProp];}
177 protected override ConfigurationPropertyCollection Properties
{
178 get { return properties; }
181 public static WebServicesSection Current
{
182 get { return (WebServicesSection) ConfigurationManager.GetSection ("system.web/webServices"); }
185 internal static bool IsSupported (WebServiceProtocols proto
)
187 return ((Current
.EnabledProtocols
& proto
) == proto
&& (proto
!= WebServiceProtocols
.Unknown
));