implemented large parts of WCF standard endpoints and configuration support.
authorAtsushi Eno <atsushi@ximian.com>
Mon, 13 Sep 2010 13:36:37 +0000 (22:36 +0900)
committerAtsushi Eno <atsushi@ximian.com>
Mon, 13 Sep 2010 13:36:37 +0000 (22:36 +0900)
26 files changed:
data/net_4_0/machine.config
mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebHttpEndpointCollectionElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebHttpEndpointElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebScriptEndpointCollectionElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebScriptEndpointElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpEndpoint.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebScriptEndpoint.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebServiceEndpoint.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs
mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpEndpointTest.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Web/Test/config/webHttpBinding.config
mcs/class/System.ServiceModel.Web/common_System.ServiceModel.Web.dll.sources
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ExtensionsSection.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceMetadataEndpointCollectionElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceMetadataEndpointElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceModelSectionGroup.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/StandardEndpointsSection.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataEndpoint.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataEndpointTest.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/System.ServiceModel.Security/SecurityMessagePropertyTest.cs

index e1912412fe01d527882d233262fa1a419bf47e70..6d5018518c76ec028e1ce9380e88ed938995cbec 100644 (file)
@@ -83,6 +83,8 @@
                        <section name="extensions" type="System.ServiceModel.Configuration.ExtensionsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <section name="serviceHostingEnvironment" type="System.ServiceModel.Configuration.ServiceHostingEnvironmentSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <section name="services" type="System.ServiceModel.Configuration.ServicesSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+                       <section name="standardEndpoints" type="System.ServiceModel.Configuration.StandardEndpointsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
+                       <section name="routing" type="System.ServiceModel.Routing.Configuration.RoutingSection, System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                </sectionGroup>
                <section name="system.webServer" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <section name="uri" type="System.Configuration.UriSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <bindingExtensions>
                                <add name="webHttpBinding" type="System.ServiceModel.Configuration.WebHttpBindingCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                        </bindingExtensions>
+                       <endpointExtensions>
+                               <add name="dynamicEndpoint" type="System.ServiceModel.Discovery.Configuration.DynamicEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                               <add name="discoveryEndpoint" type="System.ServiceModel.Discovery.Configuration.DiscoveryEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                               <add name="udpDiscoveryEndpoint" type="System.ServiceModel.Discovery.Configuration.UdpDiscoveryEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                               <add name="announcementEndpoint" type="System.ServiceModel.Discovery.Configuration.AnnouncementEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                               <add name="udpAnnouncementEndpoint" type="System.ServiceModel.Discovery.Configuration.UdpAnnouncementEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                               <add name="webHttpEndpoint" type="System.ServiceModel.Configuration.WebHttpEndpointCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                               <add name="webScriptEndpoint" type="System.ServiceModel.Configuration.WebScriptEndpointCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                       </endpointExtensions>
                </extensions>
        </system.serviceModel>
 </configuration>
index 83fee566630e7ac9bd343917be1d9545fe1667c5..d1746b94f2cb43a108d7e3260dab09edf81bb2d1 100644 (file)
@@ -41,7 +41,6 @@ namespace System.ServiceModel.Channels
 #endif
        {
                Encoding write_encoding;
-               XmlDictionaryReaderQuotas reader_quotas;
                WebContentTypeMapper content_type_mapper;
                int max_read_pool_size = 0x10000, max_write_pool_size = 0x10000;
 
@@ -58,7 +57,7 @@ namespace System.ServiceModel.Channels
                                throw new ArgumentNullException ("writeEncoding");
                        WriteEncoding = writeEncoding;
 #if !NET_2_1
-                       reader_quotas = new XmlDictionaryReaderQuotas ();
+                       ReaderQuotas = new XmlDictionaryReaderQuotas ();
 #endif
                }
 
@@ -91,9 +90,7 @@ namespace System.ServiceModel.Channels
                        }
                }
 
-               public XmlDictionaryReaderQuotas ReaderQuotas {
-                       get { return reader_quotas; }
-               }
+               public XmlDictionaryReaderQuotas ReaderQuotas { get; internal set; }
 
                public Encoding WriteEncoding {
                        get { return write_encoding; }
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebHttpEndpointCollectionElement.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebHttpEndpointCollectionElement.cs
new file mode 100644 (file)
index 0000000..8bf4c92
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.ComponentModel;
+using System.ServiceModel.Description;
+
+namespace System.ServiceModel.Configuration
+{
+       public class WebHttpEndpointCollectionElement : StandardEndpointCollectionElement<WebHttpEndpoint, WebHttpEndpointElement>
+       {
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebHttpEndpointElement.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebHttpEndpointElement.cs
new file mode 100644 (file)
index 0000000..380ac8f
--- /dev/null
@@ -0,0 +1,206 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Reflection;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.ServiceModel.Web;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public class WebHttpEndpointElement : StandardEndpointElement
+       {
+               static ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection ();
+
+               static ConfigurationProperty content_type_mapper, cross_domain_script_access_enabled, host_name_comparison_mode, max_buffer_pool_size, max_buffer_size, max_received_message_size, reader_quotas, security, transfer_mode, write_encoding, automatic_format_selection_enabled, default_outgoing_response_format, fault_exception_enabled, help_enabled;
+
+               static WebHttpEndpointElement ()
+               {
+                       content_type_mapper = new ConfigurationProperty ("contentTypeMapper", typeof (string), "", null, null, ConfigurationPropertyOptions.None);
+                       cross_domain_script_access_enabled = new ConfigurationProperty ("crossDomainScriptAccessEnabled", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
+                       host_name_comparison_mode = new ConfigurationProperty ("hostNameComparisonMode", typeof (HostNameComparisonMode), HostNameComparisonMode.StrongWildcard, null, null, ConfigurationPropertyOptions.None);
+                       max_buffer_pool_size = new ConfigurationProperty ("maxBufferPoolSize", typeof (long), 0x80000, null, null, ConfigurationPropertyOptions.None);
+                       max_buffer_size = new ConfigurationProperty ("maxBufferSize", typeof (int), 0x10000, null, null, ConfigurationPropertyOptions.None);
+                       max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize", typeof (long), 0x10000, null, null, ConfigurationPropertyOptions.None);
+                       reader_quotas = new ConfigurationProperty ("readerQuotas", typeof (XmlDictionaryReaderQuotas), null, null, null, ConfigurationPropertyOptions.None);
+                       security = new ConfigurationProperty ("security", typeof (WebHttpSecurity), null, null, null, ConfigurationPropertyOptions.None);
+                       transfer_mode = new ConfigurationProperty ("transferMode", typeof (TransferMode), TransferMode.Buffered, null, null, ConfigurationPropertyOptions.None);
+                       write_encoding = new ConfigurationProperty ("writeEncoding", typeof (Encoding), "utf-8", new EncodingConverter (), null, ConfigurationPropertyOptions.None);
+                       automatic_format_selection_enabled = new ConfigurationProperty ("automaticFormatSelectionEnabled", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
+                       default_outgoing_response_format = new ConfigurationProperty ("defaultOutgoingResponseFormat", typeof (WebMessageFormat), WebMessageFormat.Xml, null, null, ConfigurationPropertyOptions.None);
+                       fault_exception_enabled = new ConfigurationProperty ("faultExceptionEnabled", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
+                       help_enabled = new ConfigurationProperty ("helpEnabled", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
+
+                       foreach (var item in new ConfigurationProperty [] {content_type_mapper, cross_domain_script_access_enabled, host_name_comparison_mode, max_buffer_pool_size, max_buffer_size, max_received_message_size, reader_quotas, security, transfer_mode, write_encoding, automatic_format_selection_enabled, default_outgoing_response_format, fault_exception_enabled, help_enabled})
+                               properties.Add (item);
+               }
+
+               protected internal override Type EndpointType {
+                       get { return typeof (WebHttpEndpoint); }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
+               }
+
+               [ConfigurationProperty ("contentTypeMapper", DefaultValue = "")]
+               [StringValidator (MinLength = 0)]
+               public string ContentTypeMapper {
+                       get { return (string) this ["contentTypeMapper"]; }
+                       set { this ["contentTypeMapper"] = value; }
+               }
+
+               [ConfigurationProperty ("crossDomainScriptAccessEnabled", DefaultValue = false)]
+               public bool CrossDomainScriptAccessEnabled {
+                       get { return (bool) this ["crossDomainScriptAccessEnabled"]; }
+                       set { this ["crossDomainScriptAccessEnabled"] = value; }
+               }
+
+               [ConfigurationProperty ("hostNameComparisonMode", DefaultValue = HostNameComparisonMode.StrongWildcard)]
+               public HostNameComparisonMode HostNameComparisonMode {
+                       get { return (HostNameComparisonMode) this ["hostNameComparisonMode"]; }
+                       set { this ["hostNameComparisonMode"] = value; }
+               }
+
+               [LongValidator (MinValue = 0, MaxValue = long.MaxValue, ExcludeRange = false)]
+               [ConfigurationProperty ("maxBufferPoolSize", DefaultValue = 0x80000,
+                        Options = ConfigurationPropertyOptions.None)]
+               public long MaxBufferPoolSize {
+                       get { return (long) this ["maxBufferPoolSize"]; }
+                       set { this ["maxBufferPoolSize"] = value; }
+               }
+
+               [IntegerValidator ( MinValue = 1,
+                       MaxValue = int.MaxValue,
+                       ExcludeRange = false)]
+               [ConfigurationProperty ("maxBufferSize", DefaultValue = 0x10000,
+                        Options = ConfigurationPropertyOptions.None)]
+               public int MaxBufferSize {
+                       get { return (int) this ["maxBufferSize"]; }
+                       set { this ["maxBufferSize"] = value; }
+               }
+
+               [LongValidator ( MinValue = 1, MaxValue = long.MaxValue, ExcludeRange = false)]
+               [ConfigurationProperty ("maxReceivedMessageSize", DefaultValue = 0x10000,
+                        Options = ConfigurationPropertyOptions.None)]
+               public long MaxReceivedMessageSize {
+                       get { return (long) this ["maxReceivedMessageSize"]; }
+                       set { this ["maxReceivedMessageSize"] = value; }
+               }
+
+               [ConfigurationProperty ("readerQuotas")]
+               public XmlDictionaryReaderQuotasElement ReaderQuotas {
+                       get { return (XmlDictionaryReaderQuotasElement) this ["readerQuotas"]; }
+               }
+
+               [ConfigurationProperty ("security")]
+               public WebHttpSecurityElement Security {
+                       get { return (WebHttpSecurityElement) this ["security"]; }
+               }
+
+               [ConfigurationProperty ("transferMode", DefaultValue = TransferMode.Buffered)]
+               public TransferMode TransferMode {
+                       get { return (TransferMode) this ["transferMode"]; }
+                       set { this ["transferMode"] = value; }
+               }
+
+               [TypeConverter (typeof (EncodingConverter))]
+               [ConfigurationProperty ("writeEncoding", DefaultValue = "utf-8")]
+               public Encoding WriteEncoding {
+                       get { return (Encoding) this ["writeEncoding"]; }
+                       set { this ["writeEncoding"] = value; }
+               }
+
+
+               [ConfigurationProperty ("automaticFormatSelectionEnabled", DefaultValue = false)]
+               public bool AutomaticFormatSelectionEnabled {
+                       get { return (bool) this ["automaticFormatSelectionEnabled"]; }
+                       set { this ["automaticFormatSelectionEnabled"] = value; }
+               }
+
+               [ConfigurationProperty ("defaultOutgoingResponseFormat", DefaultValue = WebMessageFormat.Xml)]
+               public WebMessageFormat DefaultOutgoingResponseFormat {
+                       get { return (WebMessageFormat) this ["defaultOutgoingResponseFormat"]; }
+                       set { this ["defaultOutgoingResponseFormat"] = value; }
+               }
+
+               [ConfigurationProperty ("faultExceptionEnabled", DefaultValue = false)]
+               public bool FaultExceptionEnabled {
+                       get { return (bool) this ["faultExceptionEnabled"]; }
+                       set { this ["faultExceptionEnabled"] = value; }
+               }
+
+               [ConfigurationProperty ("helpEnabled", DefaultValue = false)]
+               public bool HelpEnabled {
+                       get { return (bool) this ["helpEnabled"]; }
+                       set { this ["helpEnabled"] = value; }
+               }
+
+
+               protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebScriptEndpointCollectionElement.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebScriptEndpointCollectionElement.cs
new file mode 100644 (file)
index 0000000..7a5a9ec
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.ComponentModel;
+using System.ServiceModel.Description;
+
+namespace System.ServiceModel.Configuration
+{
+       public class WebScriptEndpointCollectionElement : StandardEndpointCollectionElement<WebScriptEndpoint, WebScriptEndpointElement>
+       {
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebScriptEndpointElement.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Configuration/WebScriptEndpointElement.cs
new file mode 100644 (file)
index 0000000..e12f1f0
--- /dev/null
@@ -0,0 +1,176 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Reflection;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.ServiceModel.Web;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public class WebScriptEndpointElement : StandardEndpointElement
+       {
+               static ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection ();
+
+               static ConfigurationProperty content_type_mapper, cross_domain_script_access_enabled, host_name_comparison_mode, max_buffer_pool_size, max_buffer_size, max_received_message_size, reader_quotas, security, transfer_mode, write_encoding;
+
+               static WebScriptEndpointElement ()
+               {
+                       content_type_mapper = new ConfigurationProperty ("contentTypeMapper", typeof (string), "", null, null, ConfigurationPropertyOptions.None);
+                       cross_domain_script_access_enabled = new ConfigurationProperty ("crossDomainScriptAccessEnabled", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
+                       host_name_comparison_mode = new ConfigurationProperty ("hostNameComparisonMode", typeof (HostNameComparisonMode), HostNameComparisonMode.StrongWildcard, null, null, ConfigurationPropertyOptions.None);
+                       max_buffer_pool_size = new ConfigurationProperty ("maxBufferPoolSize", typeof (long), 0x80000, null, null, ConfigurationPropertyOptions.None);
+                       max_buffer_size = new ConfigurationProperty ("maxBufferSize", typeof (int), 0x10000, null, null, ConfigurationPropertyOptions.None);
+                       max_received_message_size = new ConfigurationProperty ("maxReceivedMessageSize", typeof (long), 0x10000, null, null, ConfigurationPropertyOptions.None);
+                       reader_quotas = new ConfigurationProperty ("readerQuotas", typeof (XmlDictionaryReaderQuotas), null, null, null, ConfigurationPropertyOptions.None);
+                       security = new ConfigurationProperty ("security", typeof (WebHttpSecurity), null, null, null, ConfigurationPropertyOptions.None);
+                       transfer_mode = new ConfigurationProperty ("transferMode", typeof (TransferMode), TransferMode.Buffered, null, null, ConfigurationPropertyOptions.None);
+                       write_encoding = new ConfigurationProperty ("writeEncoding", typeof (Encoding), "utf-8", new EncodingConverter (), null, ConfigurationPropertyOptions.None);
+
+                       foreach (var item in new ConfigurationProperty [] {content_type_mapper, cross_domain_script_access_enabled, host_name_comparison_mode, max_buffer_pool_size, max_buffer_size, max_received_message_size, reader_quotas, security, transfer_mode, write_encoding})
+                               properties.Add (item);
+               }
+
+               protected internal override Type EndpointType {
+                       get { return typeof (WebScriptEndpoint); }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
+               }
+
+               [ConfigurationProperty ("contentTypeMapper", DefaultValue = "")]
+               [StringValidator (MinLength = 0)]
+               public string ContentTypeMapper {
+                       get { return (string) this ["contentTypeMapper"]; }
+                       set { this ["contentTypeMapper"] = value; }
+               }
+
+               [ConfigurationProperty ("crossDomainScriptAccessEnabled", DefaultValue = false)]
+               public bool CrossDomainScriptAccessEnabled {
+                       get { return (bool) this ["crossDomainScriptAccessEnabled"]; }
+                       set { this ["crossDomainScriptAccessEnabled"] = value; }
+               }
+
+               [ConfigurationProperty ("hostNameComparisonMode", DefaultValue = HostNameComparisonMode.StrongWildcard)]
+               public HostNameComparisonMode HostNameComparisonMode {
+                       get { return (HostNameComparisonMode) this ["hostNameComparisonMode"]; }
+                       set { this ["hostNameComparisonMode"] = value; }
+               }
+
+               [LongValidator (MinValue = 0, MaxValue = long.MaxValue, ExcludeRange = false)]
+               [ConfigurationProperty ("maxBufferPoolSize", DefaultValue = 0x80000,
+                        Options = ConfigurationPropertyOptions.None)]
+               public long MaxBufferPoolSize {
+                       get { return (long) this ["maxBufferPoolSize"]; }
+                       set { this ["maxBufferPoolSize"] = value; }
+               }
+
+               [IntegerValidator ( MinValue = 1,
+                       MaxValue = int.MaxValue,
+                       ExcludeRange = false)]
+               [ConfigurationProperty ("maxBufferSize", DefaultValue = 0x10000,
+                        Options = ConfigurationPropertyOptions.None)]
+               public int MaxBufferSize {
+                       get { return (int) this ["maxBufferSize"]; }
+                       set { this ["maxBufferSize"] = value; }
+               }
+
+               [LongValidator ( MinValue = 1, MaxValue = long.MaxValue, ExcludeRange = false)]
+               [ConfigurationProperty ("maxReceivedMessageSize", DefaultValue = 0x10000,
+                        Options = ConfigurationPropertyOptions.None)]
+               public long MaxReceivedMessageSize {
+                       get { return (long) this ["maxReceivedMessageSize"]; }
+                       set { this ["maxReceivedMessageSize"] = value; }
+               }
+
+               [ConfigurationProperty ("readerQuotas")]
+               public XmlDictionaryReaderQuotasElement ReaderQuotas {
+                       get { return (XmlDictionaryReaderQuotasElement) this ["readerQuotas"]; }
+               }
+
+               [ConfigurationProperty ("security")]
+               public WebHttpSecurityElement Security {
+                       get { return (WebHttpSecurityElement) this ["security"]; }
+               }
+
+               [ConfigurationProperty ("transferMode", DefaultValue = TransferMode.Buffered)]
+               public TransferMode TransferMode {
+                       get { return (TransferMode) this ["transferMode"]; }
+                       set { this ["transferMode"] = value; }
+               }
+
+               [TypeConverter (typeof (EncodingConverter))]
+               [ConfigurationProperty ("writeEncoding", DefaultValue = "utf-8")]
+               public Encoding WriteEncoding {
+                       get { return (Encoding) this ["writeEncoding"]; }
+                       set { this ["writeEncoding"] = value; }
+               }
+
+               protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
index 4c62750cc3148db88aaca1bc9cab186eddb45632..38b804ff4921ddbbd9e6c8f4e0b038a6a0aa8434 100644 (file)
@@ -75,6 +75,14 @@ namespace System.ServiceModel.Description
                        DefaultOutgoingResponseFormat = WebMessageFormat.Xml;
                }
 
+#if NET_4_0
+               public virtual bool AutomaticFormatSelectionEnabled { get; set; }
+
+               public virtual bool FaultExceptionEnabled { get; set; }
+
+               public virtual bool HelpEnabled { get; set; }
+#endif
+
                public virtual WebMessageBodyStyle DefaultBodyStyle { get; set; }
 
                public virtual WebMessageFormat DefaultOutgoingRequestFormat { get; set; }
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpEndpoint.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpEndpoint.cs
new file mode 100644 (file)
index 0000000..97d6ca0
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+using System;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.Web;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Description
+{
+       [MonoTODO]
+       public class WebHttpEndpoint : WebServiceEndpoint
+       {
+               public WebHttpEndpoint (ContractDescription contract)
+                       : this (contract, null)
+               {
+               }
+
+               public WebHttpEndpoint (ContractDescription contract, EndpointAddress address)
+                       : base (contract, address)
+               {
+               }
+
+               WebHttpBehavior wb {
+                       get {
+                               var b = Behaviors.Find<WebHttpBehavior> ();
+                               if (b != null)
+                                       return b;
+                               throw new InvalidOperationException ("The preset WebHttpBehavior was unexpectedly removed.");
+                       }
+               }
+
+               public bool AutomaticFormatSelectionEnabled {
+                       get { return wb.AutomaticFormatSelectionEnabled; }
+                       set { wb.AutomaticFormatSelectionEnabled = value; }
+               }
+
+               public WebMessageFormat DefaultOutgoingResponseFormat {
+                       get { return wb.DefaultOutgoingResponseFormat; }
+                       set { wb.DefaultOutgoingResponseFormat = value; }
+               }
+
+               public bool FaultExceptionEnabled {
+                       get { return wb.FaultExceptionEnabled; }
+                       set { wb.FaultExceptionEnabled = value; }
+               }
+
+               public bool HelpEnabled {
+                       get { return wb.HelpEnabled; }
+                       set { wb.HelpEnabled = value; }
+               }
+
+               protected override Type WebEndpointType {
+                       get { throw new NotImplementedException (); }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebScriptEndpoint.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebScriptEndpoint.cs
new file mode 100644 (file)
index 0000000..4b37bce
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+using System;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+
+namespace System.ServiceModel.Description
+{
+       [MonoTODO]
+       public class WebScriptEndpoint : WebServiceEndpoint
+       {
+               public WebScriptEndpoint (ContractDescription contract)
+                       : this (contract, null)
+               {
+               }
+               
+               public WebScriptEndpoint (ContractDescription contract, EndpointAddress address)
+                       : base (contract, address)
+               {
+               }
+
+               protected override Type WebEndpointType {
+                       get { throw new NotImplementedException (); }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebServiceEndpoint.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebServiceEndpoint.cs
new file mode 100644 (file)
index 0000000..9b2a9b6
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+using System;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.Web;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Description
+{
+       public abstract class WebServiceEndpoint : ServiceEndpoint
+       {
+               internal WebServiceEndpoint (ContractDescription contract, EndpointAddress address)
+                       : base (contract, new WebHttpBinding (), address)
+               {
+                       Behaviors.Add (new WebHttpBehavior ());
+               }
+
+               protected abstract Type WebEndpointType { get; }
+
+               WebHttpBinding wbind {
+                       get {
+                               if (Binding is WebHttpBinding)
+                                       return (WebHttpBinding) Binding;
+                               throw new InvalidOperationException ("Binding on this standard endpoint is not supposed to be overwritten.");
+                       }
+               }
+
+               public WebContentTypeMapper ContentTypeMapper {
+                       get { return wbind.ContentTypeMapper; }
+                       set { wbind.ContentTypeMapper = value; }
+               }
+
+               public bool CrossDomainScriptAccessEnabled {
+                       get { return wbind.CrossDomainScriptAccessEnabled; }
+                       set { wbind.CrossDomainScriptAccessEnabled = value; }
+               }
+
+               public HostNameComparisonMode HostNameComparisonMode {
+                       get { return wbind.HostNameComparisonMode; }
+                       set { wbind.HostNameComparisonMode = value; }
+               }
+
+               public long MaxBufferPoolSize {
+                       get { return wbind.MaxBufferPoolSize; }
+                       set { wbind.MaxBufferPoolSize = value; }
+               }
+
+               public int MaxBufferSize {
+                       get { return wbind.MaxBufferSize; }
+                       set { wbind.MaxBufferSize = value; }
+               }
+
+               public long MaxReceivedMessageSize {
+                       get { return wbind.MaxReceivedMessageSize; }
+                       set { wbind.MaxReceivedMessageSize = value; }
+               }
+
+               public XmlDictionaryReaderQuotas ReaderQuotas {
+                       get { return wbind.ReaderQuotas; }
+                       set { wbind.ReaderQuotas = value; }
+               }
+
+               public WebHttpSecurity Security {
+                       get { return wbind.Security; }
+               }
+
+               public TransferMode TransferMode {
+                       get { return wbind.TransferMode; }
+                       set { wbind.TransferMode = value; }
+               }
+
+               public Encoding WriteEncoding {
+                       get { return wbind.WriteEncoding; }
+                       set { wbind.WriteEncoding = value; }
+               }
+       }
+}
+#endif
index 9194e24d7dec468cc3e6efcdf7f6b80fa9556ddc..e6db41560996538dd7d9295e2ca8f24150a9d730 100644 (file)
@@ -6,6 +6,7 @@ System.ServiceModel.Channels/WebBodyFormatMessagePropertyTest.cs
 System.ServiceModel.Channels/WebMessageEncodingBindingElementTest.cs
 System.ServiceModel.Configuration/WebHttpBindingElementTest.cs
 System.ServiceModel.Description/WebHttpBehaviorTest.cs
+System.ServiceModel.Description/WebHttpEndpointTest.cs
 System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs
 System.ServiceModel.Dispatcher/JsonQueryStringConverterTest.cs
 System.ServiceModel.Dispatcher/QueryStringConverterTest.cs
index 56e59eaadd25f244d404dfa888fb00483839472f..74035fcf2ab950f46db459900000fc5d2d7c1fcb 100644 (file)
@@ -60,12 +60,11 @@ namespace System.ServiceModel
                        throw new NotImplementedException ();
                }
 
-               XmlDictionaryReaderQuotas quotas;
                WebHttpSecurity security = new WebHttpSecurity ();
-               Encoding write_encoding = Encoding.UTF8;
                HttpTransportBindingElement t;
                // This can be changed only using <synchronousReceive> configuration element.
                bool receive_synchronously;
+               WebMessageEncodingBindingElement msgenc = new WebMessageEncodingBindingElement ();
 
                public EnvelopeVersion EnvelopeVersion {
                        get { return EnvelopeVersion.None; }
@@ -82,6 +81,16 @@ namespace System.ServiceModel
                        set { t.BypassProxyOnLocal = value; }
                }
 
+#if NET_4_0
+               [MonoTODO]
+               public bool CrossDomainScriptAccessEnabled { get; set; }
+
+               public WebContentTypeMapper ContentTypeMapper {
+                       get { return msgenc.ContentTypeMapper; }
+                       set { msgenc.ContentTypeMapper = value; }
+               }
+#endif
+
                public HostNameComparisonMode HostNameComparisonMode {
                        get { return t.HostNameComparisonMode; }
                        set { t.HostNameComparisonMode = value; }
@@ -120,8 +129,8 @@ namespace System.ServiceModel
 
 #if !NET_2_1
                public XmlDictionaryReaderQuotas ReaderQuotas {
-                       get { return quotas; }
-                       set { quotas = value; }
+                       get { return msgenc.ReaderQuotas; }
+                       set { msgenc.ReaderQuotas = value; }
                }
 #endif
 
@@ -134,23 +143,17 @@ namespace System.ServiceModel
                }
 
                public Encoding WriteEncoding {
-                       get { return write_encoding; }
+                       get { return msgenc.WriteEncoding; }
                        set {
                                if (value == null)
                                        throw new ArgumentNullException ("value");
-                               write_encoding = value; 
+                               msgenc.WriteEncoding = value; 
                        }
                }
 
                public override BindingElementCollection CreateBindingElements ()
                {
-                       WebMessageEncodingBindingElement m = new WebMessageEncodingBindingElement (WriteEncoding);
-#if !NET_2_1
-                       if (ReaderQuotas != null)
-                               ReaderQuotas.CopyTo (m.ReaderQuotas);
-#endif
-
-                       return new BindingElementCollection (new BindingElement [] { m, t.Clone () });
+                       return new BindingElementCollection (new BindingElement [] { msgenc, t.Clone () });
                }
 
 #if !NET_2_1
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpEndpointTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpEndpointTest.cs
new file mode 100644 (file)
index 0000000..a3a64b5
--- /dev/null
@@ -0,0 +1,35 @@
+#if NET_4_0
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.Web;
+using System.Text;
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.Description
+{
+       [TestFixture]
+       public class WebHttpEndpointTest
+       {
+               [Test]
+               public void ReplaceBinding1 ()
+               {
+                       var se = new WebHttpEndpoint (ContractDescription.GetContract (typeof (IMetadataExchange)), null);
+                       se.Binding = new NetTcpBinding (); // this does not throw exception yet.
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ReplaceBinding2 ()
+               {
+                       var se = new WebHttpEndpoint (ContractDescription.GetContract (typeof (IMetadataExchange)), null);
+                       se.Binding = new NetTcpBinding ();
+                       se.WriteEncoding = Encoding.UTF8;
+               }
+       }
+}
+#endif
index d28218d4f622a14cb1c573430403868493d7bcee..5e01695dbc46780109286acad36efea77ec2b45b 100644 (file)
                maxReceivedMessageSize="16384"
                proxyAddress="proxy"
                writeEncoding="unicode"
-               transferMode="streamed">
+               transferMode="Streamed">
             <security mode="TransportCredentialOnly">
               <transport 
                clientCredentialType="Basic"
-               proxyCredentialType="NTLM"
+               proxyCredentialType="Ntlm"
                realm="realm" />
             </security>
           </binding>
         </webHttpBinding>
       </bindings>
     </system.serviceModel>
-</configuration>
\ No newline at end of file
+</configuration>
index 04dbe4f9bd70b8f571c93fa6bede68d9d4f9cc90..d9b9abcc1a27c9206afade6b8e2b350bd27f470f 100644 (file)
@@ -13,11 +13,18 @@ System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
 System.ServiceModel.Configuration/WebHttpBindingCollectionElement.cs
 System.ServiceModel.Configuration/WebHttpBindingElement.cs
 System.ServiceModel.Configuration/WebHttpElement.cs
+System.ServiceModel.Configuration/WebHttpEndpointCollectionElement.cs
+System.ServiceModel.Configuration/WebHttpEndpointElement.cs
 System.ServiceModel.Configuration/WebHttpSecurityElement.cs
 System.ServiceModel.Configuration/WebMessageEncodingElement.cs
 System.ServiceModel.Configuration/WebScriptEnablingElement.cs
+System.ServiceModel.Configuration/WebScriptEndpointCollectionElement.cs
+System.ServiceModel.Configuration/WebScriptEndpointElement.cs
 System.ServiceModel.Description/WebHttpBehavior.cs
+System.ServiceModel.Description/WebHttpEndpoint.cs
 System.ServiceModel.Description/WebScriptEnablingBehavior.cs
+System.ServiceModel.Description/WebScriptEndpoint.cs
+System.ServiceModel.Description/WebServiceEndpoint.cs
 System.ServiceModel.Dispatcher/JsonQueryStringConverter.cs
 System.ServiceModel.Dispatcher/QueryStringConverter.cs
 System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
index 4e888ef038c95261d014063724c195057460d6f9..0fd02c3395726d018ff63bd1eb702d72fc244d8a 100644 (file)
@@ -79,6 +79,14 @@ namespace System.ServiceModel.Configuration
                        get { return (ExtensionElementCollection) base ["bindingExtensions"]; }
                }
 
+#if NET_4_0
+               [ConfigurationProperty ("endpointExtensions",
+                        Options = ConfigurationPropertyOptions.None)]
+               public ExtensionElementCollection EndpointExtensions {
+                       get { return (ExtensionElementCollection) base ["endpointExtensions"]; }
+               }
+#endif
+
                protected override ConfigurationPropertyCollection Properties {
                        get {
                                if (_properties == null) {
@@ -86,6 +94,9 @@ namespace System.ServiceModel.Configuration
                                        _properties.Add (new ConfigurationProperty ("behaviorExtensions", typeof (ExtensionElementCollection), null, null, null, ConfigurationPropertyOptions.None));
                                        _properties.Add (new ConfigurationProperty ("bindingElementExtensions", typeof (ExtensionElementCollection), null, null, null, ConfigurationPropertyOptions.None));
                                        _properties.Add (new ConfigurationProperty ("bindingExtensions", typeof (ExtensionElementCollection), null, null, null, ConfigurationPropertyOptions.None));
+#if NET_4_0
+                                       _properties.Add (new ConfigurationProperty ("endpointExtensions", typeof (ExtensionElementCollection), null, null, null, ConfigurationPropertyOptions.None));
+#endif
                                }
                                return _properties;
                        }
@@ -95,6 +106,9 @@ namespace System.ServiceModel.Configuration
                        InitializeBehaviorExtensionsDefault ();
                        InitializeBindingElementExtensionsDefault ();
                        InitializeBindingExtensionsDefault ();
+#if NET_4_0
+                       InitializeEndpointExtensionsDefault ();
+#endif
                }
 
                void InitializeBindingExtensionsDefault () {
@@ -157,6 +171,11 @@ namespace System.ServiceModel.Configuration
                        BehaviorExtensions.Add (new ExtensionElement ("transactedBatching", typeof (TransactedBatchingElement).AssemblyQualifiedName));
                }
 
+#if NET_4_0
+               void InitializeEndpointExtensionsDefault () {
+                       EndpointExtensions.Add (new ExtensionElement ("mexEndpoint", typeof (ServiceMetadataEndpointCollectionElement).AssemblyQualifiedName));
+               }
+#endif
        }
 
 }
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceMetadataEndpointCollectionElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceMetadataEndpointCollectionElement.cs
new file mode 100644 (file)
index 0000000..90ee434
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.ComponentModel;
+using System.ServiceModel.Description;
+
+namespace System.ServiceModel.Configuration
+{
+       public class ServiceMetadataEndpointCollectionElement : StandardEndpointCollectionElement<ServiceMetadataEndpoint, ServiceMetadataEndpointElement>
+       {
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceMetadataEndpointElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceMetadataEndpointElement.cs
new file mode 100644 (file)
index 0000000..e23239b
--- /dev/null
@@ -0,0 +1,101 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public class ServiceMetadataEndpointElement : StandardEndpointElement
+       {
+               static ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection ();
+
+               static ServiceMetadataEndpointElement ()
+               {
+                       foreach (var item in new ConfigurationProperty [] {})
+                               properties.Add (item);
+               }
+
+               protected internal override Type EndpointType {
+                       get { return typeof (ServiceMetadataEndpoint); }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
+               }
+
+               protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
index b9c5433e09c27b82ba9f107f609c806f3ccf8fff..3e131e7afd8d45e569850b726b26850328e2178f 100644 (file)
@@ -78,5 +78,11 @@ namespace System.ServiceModel.Configuration
                public ServicesSection Services {
                        get { return (ServicesSection) Sections ["services"]; }
                }
+
+#if NET_4_0
+               public StandardEndpointsSection StandardEndpoints {
+                       get { return (StandardEndpointsSection) Sections ["standardEndpoints"]; }
+               }
+#endif
        }
 }
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/StandardEndpointsSection.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/StandardEndpointsSection.cs
new file mode 100644 (file)
index 0000000..69fed1b
--- /dev/null
@@ -0,0 +1,120 @@
+//
+// BindingsSection.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public sealed class StandardEndpointsSection : ConfigurationSection
+       {
+               ConfigurationPropertyCollection _properties;
+
+               // Properties
+
+               List<EndpointCollectionElement> endpoint_collections;
+
+               public List<EndpointCollectionElement> EndpointCollections {
+                       get {
+                               if (endpoint_collections != null)
+                                       return endpoint_collections;
+                               var list = new List<EndpointCollectionElement> ();
+                               foreach (ConfigurationProperty cp in Properties)
+                                       list.Add ((EndpointCollectionElement) this [cp]);
+                               endpoint_collections = list;
+                               return list;
+                       }
+               }
+
+
+               [ConfigurationProperty ("mexEndpoint", Options = ConfigurationPropertyOptions.None)]
+               public ServiceMetadataEndpointCollectionElement MexEndpoint {
+                       get { return (ServiceMetadataEndpointCollectionElement) this ["mexEndpoint"]; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get {
+                               if (_properties == null) {
+                                       _properties = new ConfigurationPropertyCollection ();
+                                       ExtensionElementCollection extensions = ((ExtensionsSection) EvaluationContext.GetSection ("system.serviceModel/extensions")).EndpointExtensions;
+                                       for (int i = 0; i < extensions.Count; i++) {
+                                               ExtensionElement extension = extensions [i];
+                                               _properties.Add (new ConfigurationProperty (extension.Name, Type.GetType (extension.Type), null, null, null, ConfigurationPropertyOptions.None));
+                                       }
+                               }
+                               return _properties;
+                       }
+               }
+
+               public static StandardEndpointsSection GetSection (System.Configuration.Configuration config) {
+                       ServiceModelSectionGroup sm = ServiceModelSectionGroup.GetSectionGroup (config);
+                       if (sm == null)
+                               throw new SystemException ("Could not retrieve configuration section group 'system.serviceModel'");
+                       if (sm.StandardEndpoints == null)
+                               throw new SystemException ("Could not retrieve configuration sub section group 'standardEndpoints' in 'system.serviceModel'");
+                       return sm.StandardEndpoints;
+               }
+
+               public new EndpointCollectionElement this [string name] {
+                       get {
+                               object element = base [name];
+                               if (element is EndpointCollectionElement)
+                                       return (EndpointCollectionElement) element;
+                               throw new ArgumentException (String.Format ("Could not find {0}", name));
+                       }
+               }
+
+       }
+
+}
+
+#endif
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataEndpoint.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataEndpoint.cs
new file mode 100644 (file)
index 0000000..6abcf13
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+using System;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using System.ServiceModel.Channels;
+
+namespace System.ServiceModel.Description
+{
+       public class ServiceMetadataEndpoint : ServiceEndpoint
+       {
+               public ServiceMetadataEndpoint ()
+                       : this (null)
+               {
+               }
+               
+               public ServiceMetadataEndpoint (EndpointAddress address)
+                       : this (MetadataExchangeBindings.CreateMexHttpBinding (), address)
+               {
+               }
+               
+               public ServiceMetadataEndpoint (Binding binding, EndpointAddress address)
+                       : base (ContractDescription.GetContract (typeof (IMetadataExchange)), binding, address)
+               {
+               }
+       }
+}
+
+#endif
index 344ac16f4d8356f217924cd5724a3cbbb627b88b..c9ab97a79187781caef56d48e53ba0196e6e4aa1 100644 (file)
@@ -468,6 +468,8 @@ System.ServiceModel.Configuration/ServiceElementCollection.cs
 System.ServiceModel.Configuration/ServiceEndpointElement.cs
 System.ServiceModel.Configuration/ServiceEndpointElementCollection.cs
 System.ServiceModel.Configuration/ServiceHostingEnvironmentSection.cs
+System.ServiceModel.Configuration/ServiceMetadataEndpointCollectionElement.cs
+System.ServiceModel.Configuration/ServiceMetadataEndpointElement.cs
 System.ServiceModel.Configuration/ServiceMetadataPublishingElement.cs
 System.ServiceModel.Configuration/ServiceModelConfigurationElementCollection.cs
 System.ServiceModel.Configuration/ServiceModelEnhancedConfigurationElementCollection.cs
@@ -488,6 +490,7 @@ System.ServiceModel.Configuration/StandardBindingReliableSessionElement.cs
 System.ServiceModel.Configuration/StandardEndpointCollectionElement.cs
 System.ServiceModel.Configuration/StandardEndpointElement.cs
 System.ServiceModel.Configuration/StandardEndpointElementCollection.cs
+System.ServiceModel.Configuration/StandardEndpointsSection.cs
 System.ServiceModel.Configuration/SynchronousReceiveElement.cs
 System.ServiceModel.Configuration/TcpConnectionPoolSettingsElement.cs
 System.ServiceModel.Configuration/TcpTransportElement.cs
@@ -601,6 +604,7 @@ System.ServiceModel.Description/ServiceDescription.cs
 System.ServiceModel.Description/ServiceEndpoint.cs
 System.ServiceModel.Description/ServiceEndpointCollection.cs
 System.ServiceModel.Description/ServiceMetadataBehavior.cs
+System.ServiceModel.Description/ServiceMetadataEndpoint.cs
 System.ServiceModel.Description/ServiceMetadataExtension.cs
 System.ServiceModel.Description/ServiceSecurityAuditBehavior.cs
 System.ServiceModel.Description/ServiceThrottlingBehavior.cs
index 2b8e7817b4ebcbc2f2a692d5c76d872829c4f2d9..285d31310d6855e2a6347c9c448aa7c141cf176a 100644 (file)
@@ -98,6 +98,7 @@ System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs
 System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs
 System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs
 System.ServiceModel.Configuration/StandardBindingElementTest.cs
+System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs
 System.ServiceModel.Configuration/UserBinding.cs
 System.ServiceModel.Description/ClientCredentialsTest.cs
 System.ServiceModel.Description/ContractDescriptionTest.cs
@@ -111,6 +112,7 @@ System.ServiceModel.Description/ServiceCredentialsTest.cs
 System.ServiceModel.Description/ServiceDebugBehaviorTest.cs
 System.ServiceModel.Description/ServiceEndpointTest.cs
 System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs
+System.ServiceModel.Description/ServiceMetadataEndpointTest.cs
 System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs
 System.ServiceModel.Description/TypedMessageConverterTest.cs
 System.ServiceModel.Description/WsdlExporterTest.cs
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs
new file mode 100644 (file)
index 0000000..b294efc
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// StandardEndpointsSectionTest.cs
+//
+// Author:
+//     Atsushi Enomoto  <atsushi@ximian.com>
+//
+// Copyright (C) 2010 Novell, Inc.  http://novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using System.ServiceModel;
+using System.ServiceModel.Configuration;
+using System.ServiceModel.Description;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.Channels;
+
+namespace MonoTests.System.ServiceModel.Configuration
+{
+       [TestFixture]
+       public class StandardEndpointsSectionTest
+       {
+               [Test]
+               public void ServiceMetadataExists ()
+               {
+                       var cfg = ConfigurationManager.OpenMachineConfiguration ();
+                       Assert.IsNotNull (StandardEndpointsSection.GetSection (cfg).EndpointCollections.FirstOrDefault (e => e is ServiceMetadataEndpointCollectionElement), "#1");
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataEndpointTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceMetadataEndpointTest.cs
new file mode 100644 (file)
index 0000000..2b36aea
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// ServiceEndpointTest.cs
+//
+// Author:
+//     Atsushi Enomoto  <atsushi@ximian.com>
+//
+// Copyright (C) 2009 Novell, Inc.  http://novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_4_0
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.ServiceModel;
+using System.ServiceModel.Description;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.Channels;
+
+namespace MonoTests.System.ServiceModel.Description
+{
+       [TestFixture]
+       public class ServiceMetadataEndpointTest
+       {
+               [Test]
+               public void DefaultValues ()
+               {
+                       var se = new ServiceMetadataEndpoint ();
+                       Assert.IsNotNull (se.Contract, "#1");
+                       Assert.AreEqual (typeof (IMetadataExchange), se.Contract.ContractType, "#1.2");
+                       Assert.IsNotNull (se.Binding, "#2");
+                       // FIXME: enable once we get usable WSHttpBinding.
+                       // Assert.AreEqual (typeof (WSHttpBinding), se.Binding.GetType (), "#2.2");
+                       Assert.IsNull (se.Address, "#3");
+               }
+       }
+}
+#endif
index 96242586793ac5ea2aa2318d5f89296a0896b741..b29b970197aab4b16e67ed89b2ba9d8150c83a18 100644 (file)
@@ -164,7 +164,7 @@ namespace MonoTests.System.ServiceModel.Security
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Ignore ("This hangs on .NET")]
                // not sure how "good" this test is ... if it fails at
                // service side, it just results in timeout error.
                // The assertion makes sure that it passes all the tests, but