public ConfigurationDiscoveryEndpointProvider(ChannelEndpointElement channelEndpointElement)
        {
            Fx.Assert(channelEndpointElement != null, "The channelEndpointElement parameter must be non null.");

            ConfigurationDiscoveryEndpointProvider.ValidateAndGetDiscoveryEndpoint(channelEndpointElement);
            this.channelEndpointElement = channelEndpointElement;
        }
        public void ApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
        {
            if (null == endpoint)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint");
            }

            if (null == channelEndpointElement)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
            }

            if (endpoint.GetType() != this.EndpointType)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ConfigInvalidTypeForEndpoint,
                    this.EndpointType.AssemblyQualifiedName,
                    endpoint.GetType().AssemblyQualifiedName));
            }

            // The properties endpoint.Name and this.Name are actually two different things:
            //     - endpoint.Name corresponds to the service endpoint name and is surfaced through
            //       serviceEndpointElement.Name
            //     - this.Name is a token used as a key in the endpoint collection to identify
            //       a specific bucket of configuration settings.
            // Thus, the Name property is skipped here.

            this.OnApplyConfiguration(endpoint, channelEndpointElement);
        }
        static DiscoveryEndpoint ValidateAndGetDiscoveryEndpoint(ChannelEndpointElement channelEndpointElement)
        {
            if (string.IsNullOrEmpty(channelEndpointElement.Kind))
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                    SR2.DiscoveryConfigDiscoveryEndpointMissingKind(
                    typeof(DiscoveryEndpoint).FullName)));
            }

            ServiceEndpoint serviceEndpoint = ConfigLoader.LookupEndpoint(channelEndpointElement, null);

            if (serviceEndpoint == null)
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                    SR2.DiscoveryConfigInvalidEndpointConfiguration(
                    channelEndpointElement.Kind)));
            }

            DiscoveryEndpoint discoveryEndpoint = serviceEndpoint as DiscoveryEndpoint;
            if (discoveryEndpoint == null)
            {
                throw FxTrace.Exception.AsError(
                    new InvalidOperationException(
                        SR2.DiscoveryConfigInvalidDiscoveryEndpoint(
                        typeof(DiscoveryEndpoint).FullName,
                        channelEndpointElement.Kind,
                        serviceEndpoint.GetType().FullName)));
            }

            return discoveryEndpoint;
        }
 public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (channelEndpointElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
     }
     this.OnInitializeAndValidate(channelEndpointElement);
 }
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (String.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = ConfigurationStrings.MexHttpBindingCollectionElementName;
     }
     channelEndpointElement.Contract = ServiceMetadataBehavior.MexContractName;
 }
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (string.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = "mexHttpBinding";
     }
     channelEndpointElement.Contract = "IMetadataExchange";
 }
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (String.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = ConfigurationStrings.MexHttpBindingCollectionElementName;
     }
     channelEndpointElement.Contract = ServiceMetadataBehavior.MexContractName;
 }
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (string.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = "mexHttpBinding";
     }
     channelEndpointElement.Contract = "IMetadataExchange";
 }
 public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (channelEndpointElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
     }
     this.OnInitializeAndValidate(channelEndpointElement);
 }
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     if (string.IsNullOrEmpty(channelEndpointElement.Binding))
     {
         channelEndpointElement.Binding = WebHttpBinding.WebHttpBindingConfigurationStrings.WebHttpBindingCollectionElementName;
     }
     else if (!string.Equals(channelEndpointElement.Binding, WebHttpBinding.WebHttpBindingConfigurationStrings.WebHttpBindingCollectionElementName, StringComparison.Ordinal))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR2.GetString(SR2.WebEndpointRequiredBinding, typeof(WebScriptEndpoint).Name, WebHttpBinding.WebHttpBindingConfigurationStrings.WebHttpBindingCollectionElementName)));
     }
 }
 internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
 {
     ChannelEndpointElement element = null;
     BindingDictionaryValue value2 = this.CreateBindingConfig(endpoint.Binding);
     element = new ChannelEndpointElement(endpoint.Address, typeName);
     element.Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), new NamingHelper.DoesNameExist(this.CheckIfChannelNameInUse), null);
     element.BindingConfiguration = value2.BindingName;
     element.Binding = value2.BindingSectionName;
     this.channels.Add(element);
     return element;
 }
		public void TestEmptyProps ()
		{
			ChannelEndpointElement empty = new ChannelEndpointElement ();
			Assert.AreEqual ("", empty.Name, "#01");
			Assert.AreEqual (null, empty.Contract, "#02");
			Assert.AreEqual (null, empty.Binding, "#03");
			Assert.AreEqual (null, empty.Address, "#04");
			Assert.AreEqual ("", empty.BindingConfiguration, "#05");
			Assert.AreEqual ("", empty.BehaviorConfiguration, "#06");
			Assert.IsNotNull (empty.Headers, "#07");
			Assert.IsNotNull (empty.Identity, "#08");
		}
        internal void Copy(ChannelEndpointElement source)
        {
            if (source == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }

            PropertyInformationCollection properties = source.ElementInformation.Properties;

            if (properties[ConfigurationStrings.Address].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Address = source.Address;
            }
            if (properties[ConfigurationStrings.BehaviorConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BehaviorConfiguration = source.BehaviorConfiguration;
            }
            if (properties[ConfigurationStrings.Binding].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Binding = source.Binding;
            }
            if (properties[ConfigurationStrings.BindingConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BindingConfiguration = source.BindingConfiguration;
            }
            if (properties[ConfigurationStrings.Name].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Name = source.Name;
            }
            if (properties[ConfigurationStrings.Contract].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Contract = source.Contract;
            }
            if (properties[ConfigurationStrings.Headers].ValueOrigin != PropertyValueOrigin.Default &&
                source.Headers != null)
            {
                this.Headers.Copy(source.Headers);
            }
            if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default &&
                source.Identity != null)
            {
                this.Identity.Copy(source.Identity);
            }
            if (properties[ConfigurationStrings.Kind].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Kind = source.Kind;
            }
            if (properties[ConfigurationStrings.EndpointConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.EndpointConfiguration = source.EndpointConfiguration;
            }
        }
        public void TestMatchingContractBySpecificName()
        {
            // Construct configuration settings
            ChannelEndpointElement endpoint1 = new ChannelEndpointElement(null, typeof(ITestService).FullName) { Name = "Test1" };
            ChannelEndpointElement endpoint2 = new ChannelEndpointElement(null, typeof(ITestService).FullName + "0000") { Name = "Test2" };
            ServiceModelSectionGroup context = this.CreateServiceModelSectionGroup();
            context.Client.Endpoints.Add(endpoint1);
            context.Client.Endpoints.Add(endpoint2);

            Assert.DoesNotThrow(delegate { this.LoadServiceEndPoint("Test1", context); });
            Assert.Throws(typeof(InvalidOperationException), delegate { this.LoadServiceEndPoint("TestXYZ", context); });
            Assert.Throws(typeof(InvalidOperationException), delegate { this.LoadServiceEndPoint("Test2", context); });
        }
        internal void Copy(ChannelEndpointElement source)
        {
            if (source == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }

            PropertyInformationCollection properties = source.ElementInformation.Properties;
            if (properties[ConfigurationStrings.Address].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Address = source.Address;
            }
            if (properties[ConfigurationStrings.BehaviorConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BehaviorConfiguration = source.BehaviorConfiguration;
            }
            if (properties[ConfigurationStrings.Binding].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Binding = source.Binding;
            }
            if (properties[ConfigurationStrings.BindingConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BindingConfiguration = source.BindingConfiguration;
            }
            if (properties[ConfigurationStrings.Name].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Name = source.Name;
            }
            if (properties[ConfigurationStrings.Contract].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Contract = source.Contract;
            }
            if (properties[ConfigurationStrings.Headers].ValueOrigin != PropertyValueOrigin.Default
                && source.Headers != null)
            {
                this.Headers.Copy(source.Headers);
            }
            if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default
                && source.Identity != null)
            {
                this.Identity.Copy(source.Identity);
            }
            if (properties[ConfigurationStrings.Kind].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Kind = source.Kind;
            }
            if (properties[ConfigurationStrings.EndpointConfiguration].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.EndpointConfiguration = source.EndpointConfiguration;
            }
        }
Example #16
0
        /// <summary>
        /// Generates the service model endpoints for the metadata set in the xml file for the application configuration location.
        /// </summary>
        /// <param name="metaDocs">The metadata set document.</param>
        /// <param name="xmlFile">The name of the xml file to write the configuration information to.</param>
        /// <param name="configuration">The current application configuration file instance.</param>
        /// <returns>The collection of channel endpoint elements.</returns>
        public static ChannelEndpointElement[] GenerateServiceModelEndpoints(MetadataSet metaDocs,
                                                                             string xmlFile, System.Configuration.Configuration configuration)
        {
            // Make sure the page reference exists.
            if (metaDocs == null)
            {
                throw new ArgumentNullException("metaDocs");
            }
            if (xmlFile == null)
            {
                throw new ArgumentNullException("xmlFile");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            WsdlImporter             importer  = new WsdlImporter(metaDocs);
            ServiceContractGenerator generator = new ServiceContractGenerator(configuration);

            // Get all the endpoint type bindings
            ServiceEndpointCollection serviceEndpoints = importer.ImportAllEndpoints();

            // Create a new endpoint collection.
            List <ChannelEndpointElement> endpointElements = new List <ChannelEndpointElement>();

            System.ServiceModel.Configuration.ChannelEndpointElement channelEndpoint = null;

            // For each endpoint found add the
            // type to the collection.
            foreach (ServiceEndpoint serviceEndpoint in serviceEndpoints)
            {
                generator.GenerateServiceEndpoint(serviceEndpoint, out channelEndpoint);
                endpointElements.Add(channelEndpoint);
            }

            // If no file has been specified then save to the application configuration
            // file else save to a new file specified.
            if (String.IsNullOrEmpty(xmlFile))
            {
                generator.Configuration.Save();
            }
            else
            {
                generator.Configuration.SaveAs(xmlFile);
            }

            // Return the collection of endpoints.
            return(endpointElements.ToArray());
        }
        internal void Copy(ChannelEndpointElement source)
        {
            if (source == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }
            PropertyInformationCollection properties = source.ElementInformation.Properties;

            if (properties["address"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Address = source.Address;
            }
            if (properties["behaviorConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BehaviorConfiguration = source.BehaviorConfiguration;
            }
            if (properties["binding"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Binding = source.Binding;
            }
            if (properties["bindingConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.BindingConfiguration = source.BindingConfiguration;
            }
            if (properties["name"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Name = source.Name;
            }
            if (properties["contract"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Contract = source.Contract;
            }
            if ((properties["headers"].ValueOrigin != PropertyValueOrigin.Default) && (source.Headers != null))
            {
                this.Headers.Copy(source.Headers);
            }
            if ((properties["identity"].ValueOrigin != PropertyValueOrigin.Default) && (source.Identity != null))
            {
                this.Identity.Copy(source.Identity);
            }
            if (properties["kind"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.Kind = source.Kind;
            }
            if (properties["endpointConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
            {
                this.EndpointConfiguration = source.EndpointConfiguration;
            }
        }
        public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
        {
            if (null == channelEndpointElement)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
            }

            // The properties channelEndpointElement.Name and this.Name are actually two different things:
            //     - channelEndpointElement.Name corresponds to the service endpoint name
            //     - this.Name is a token used as a key in the endpoint collection to identify
            //       a specific bucket of configuration settings.
            // Thus, the Name property is skipped here.

            this.OnInitializeAndValidate(channelEndpointElement);
        }
        public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
        {
            if (null == channelEndpointElement)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
            }

            // The properties channelEndpointElement.Name and this.Name are actually two different things:
            //     - channelEndpointElement.Name corresponds to the service endpoint name
            //     - this.Name is a token used as a key in the endpoint collection to identify
            //       a specific bucket of configuration settings.
            // Thus, the Name property is skipped here.

            this.OnInitializeAndValidate(channelEndpointElement);
        }
 internal void Copy(ChannelEndpointElement source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     PropertyInformationCollection properties = source.ElementInformation.Properties;
     if (properties["address"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Address = source.Address;
     }
     if (properties["behaviorConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.BehaviorConfiguration = source.BehaviorConfiguration;
     }
     if (properties["binding"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Binding = source.Binding;
     }
     if (properties["bindingConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.BindingConfiguration = source.BindingConfiguration;
     }
     if (properties["name"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Name = source.Name;
     }
     if (properties["contract"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Contract = source.Contract;
     }
     if ((properties["headers"].ValueOrigin != PropertyValueOrigin.Default) && (source.Headers != null))
     {
         this.Headers.Copy(source.Headers);
     }
     if ((properties["identity"].ValueOrigin != PropertyValueOrigin.Default) && (source.Identity != null))
     {
         this.Identity.Copy(source.Identity);
     }
     if (properties["kind"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Kind = source.Kind;
     }
     if (properties["endpointConfiguration"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.EndpointConfiguration = source.EndpointConfiguration;
     }
 }
 public void ApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
 {
     if (endpoint == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint");
     }
     if (channelEndpointElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
     }
     if (endpoint.GetType() != this.EndpointType)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ConfigInvalidTypeForEndpoint", new object[] { this.EndpointType.AssemblyQualifiedName, endpoint.GetType().AssemblyQualifiedName }));
     }
     this.OnApplyConfiguration(endpoint, channelEndpointElement);
 }
 public void ApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
 {
     if (endpoint == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint");
     }
     if (channelEndpointElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelEndpointElement");
     }
     if (endpoint.GetType() != this.EndpointType)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ConfigInvalidTypeForEndpoint", new object[] { this.EndpointType.AssemblyQualifiedName, endpoint.GetType().AssemblyQualifiedName }));
     }
     this.OnApplyConfiguration(endpoint, channelEndpointElement);
 }
 public static void CopyFrom(this ChannelEndpointElement to, ChannelEndpointElement from)
 {
     to.Address = from.Address;
     to.BehaviorConfiguration = from.BehaviorConfiguration;
     to.Binding = from.Binding;
     to.BindingConfiguration = from.BindingConfiguration;
     to.Contract             = from.Contract;
     if (from.Headers != null)
     {
         to.Headers.Headers = from.Headers.Headers;
     }
     if (from.Identity != null)
     {
         to.Identity.InitializeFrom(from.Identity.CreateInstance());
     }
     to.Name = from.Name;
 }
        protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
        {
            if (string.IsNullOrEmpty(channelEndpointElement.Contract))
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                        SR.DiscoveryConfigContractNotSpecified(channelEndpointElement.Kind)));
            }

            if (channelEndpointElement.Address != null && !channelEndpointElement.Address.Equals(DiscoveryClientBindingElement.DiscoveryEndpointAddress.Uri))
            {
                throw FxTrace.Exception.AsError(
                    new ConfigurationErrorsException(
                            SR.DiscoveryEndpointAddressIncorrect(
                            "address",
                            channelEndpointElement.Address, 
                            DiscoveryClientBindingElement.DiscoveryEndpointAddress.Uri)));
            }
        }
        internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
        {
            ChannelEndpointElement channelElement = null;

            // Create Binding
            BindingDictionaryValue bindingDV = CreateBindingConfig(endpoint.Binding);


            channelElement = new ChannelEndpointElement(endpoint.Address, typeName);

            // [....]: review: Use decoded form to preserve the user-given friendly name, however, beacuse our Encoding algorithm
            // does not touch ASCII names, a name that looks like encoded name will not roundtrip(Example: "_x002C_" will turned into ",")
            channelElement.Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), this.CheckIfChannelNameInUse, null);

            channelElement.BindingConfiguration = bindingDV.BindingName;
            channelElement.Binding = bindingDV.BindingSectionName;
            channels.Add(channelElement);

            return channelElement;            
        }
 protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
 {
     InternalOnApplyConfiguration(endpoint);
 }
 protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
 {
 }
 protected abstract void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement);
 protected abstract void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement);
 public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     OnInitializeAndValidate(channelEndpointElement);
 }
        public void TestMatchingContractWildcardManyEndpointsOneMatch()
        {
            // Construct configuration settings
            ChannelEndpointElement endpoint1 = new ChannelEndpointElement(null, typeof(ITestService).FullName) { Name = "Test1" };
            ChannelEndpointElement endpoint2 = new ChannelEndpointElement(null, typeof(ITestService).FullName + "0000") { Name = "Test2" };
            ServiceModelSectionGroup context = this.CreateServiceModelSectionGroup();
            context.Client.Endpoints.Add(endpoint1);
            context.Client.Endpoints.Add(endpoint2);

            ServiceEndpoint actualEndpoint = this.LoadServiceEndPoint("*", context);
            Assert.Equal(endpoint1.Contract, actualEndpoint.Contract.ContractType.FullName);
        }
        public void TestWildcardMatch()
        {
            EndpointAddress address = new EndpointAddress("http://localhost/Test");
            ChannelEndpointElement endpoint = new ChannelEndpointElement(address, typeof(ITestService).FullName);

            // Construct configuration settings
            ServiceModelSectionGroup context = this.CreateServiceModelSectionGroup();
            context.Client.Endpoints.Add(endpoint);

            // Load endpoint from settings.
            ServiceEndpoint loadedEndpoint = this.LoadServiceEndPoint("*", context);

            // Assert the endpoint loaded correctly.
            Assert.Equal(address, loadedEndpoint.Address);
            Assert.Equal(endpoint.Contract, loadedEndpoint.Contract.ContractType.FullName);
        }
 protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
 {
     //no additional configuration is required for MEX.
 }
		public CodeTypeReference GenerateServiceEndpoint (
			ServiceEndpoint endpoint,
			out ChannelEndpointElement channelElement)
		{
			throw new NotImplementedException ();
		}
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
 }
 public ConfigurationDiscoveryEndpointProvider()            
 {
     this.channelEndpointElement = ConfigurationUtility.GetDefaultDiscoveryEndpointElement();
 }
		protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
		{
			throw new NotImplementedException ();
		}
 public void ApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
 {
 }
        public void TestNoMatchingContractWhildcard()
        {
            // Construct configuration settings
            ChannelEndpointElement endpoint = new ChannelEndpointElement(null, typeof(ITestService).FullName + "0000");
            ServiceModelSectionGroup context = this.CreateServiceModelSectionGroup();
            context.Client.Endpoints.Add(endpoint);

            Assert.Throws(typeof(InvalidOperationException), delegate { this.LoadServiceEndPoint("*", context); });
        }
 protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
 {
     base.OnApplyConfiguration(endpoint, serviceEndpointElement);
     ApplyConfiguration(endpoint);
 }
 protected abstract void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement);
 protected abstract void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement);
        protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
        {
            base.OnInitializeAndValidate(channelEndpointElement);

            ConfigurationUtility.InitializeAndValidateUdpChannelEndpointElement(channelEndpointElement);
        }
 public void ApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
 {
     OnApplyConfiguration(endpoint, channelEndpointElement);
 }
 protected abstract void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement);
 public void ApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)
 {
 }
 public void InitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
 }
 protected abstract void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement);
        public static ServiceEndpoint ConfigureStandardEndpoint(ContractDescription cd, ChannelEndpointElement element)
        {
            string kind = element.Kind;
            string endpointConfiguration = element.EndpointConfiguration;

            EndpointCollectionElement section = ConfigUtil.StandardEndpointsSection [kind];

            if (section == null)
            {
                throw new ArgumentException(String.Format("standard endpoint section for '{0}' was not found.", kind));
            }

            StandardEndpointElement e = section.GetDefaultStandardEndpointElement();

            ServiceEndpoint inst = e.CreateServiceEndpoint(cd);

            foreach (StandardEndpointElement el in section.ConfiguredEndpoints)
            {
                if (el.Name == endpointConfiguration)
                {
                    el.InitializeAndValidate(element);
                    el.ApplyConfiguration(inst, element);
                    break;
                }
            }

            return(inst);
        }
 protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
 {
     //no additional configuration is required for MEX.
 }
 public static EndpointAddress CreateEndpointAddress(this ChannelEndpointElement el)
 {
     return(new EndpointAddress(el.Address, el.Identity != null ? el.Identity.CreateInstance() : null, el.Headers.Headers));
 }
Example #52
0
 protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
 {
     throw new NotImplementedException();
 }
		protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
		{
			throw new NotImplementedException ();
		}
Example #54
0
 protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
 {
     throw new NotImplementedException();
 }