public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     foreach (var op in clientRuntime.ClientOperations)
     {
         op.ClientParameterInspectors.Add(new WcfServiceCallInspector(op.Parent.ContractClientType.FullName));
     }
 }
Example #2
0
 public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     clientRuntime.ChannelInitializers.Add(new MyChannelInitializer(false));
     clientRuntime.InteractiveChannelInitializers.Add(new MyInteractiveChannelInitializer());
     clientRuntime.MessageInspectors.Add(new MyClientMessageInspector());
     clientRuntime.OperationSelector = new MyClientOperationSelector();
 }
 public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint,
                                 ClientRuntime clientRuntime)
 {
     if (!TypeHelper.IsTypeOf<IClientMessageInspector>(_inspectorType)) return;
     var inspector = TypeHelper.CreateInstance<IClientMessageInspector>(_inspectorType);
     clientRuntime.MessageInspectors.Add(inspector);
 }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     foreach (var op in endpoint.Contract.Operations) {
         if (op.Behaviors.Find<JsonRpcOperationBehavior>() == null)
             op.Behaviors.Add(new JsonRpcOperationBehavior(endpoint));
     }
 }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     if (clientRuntime != null)
     {
         clientRuntime.MessageInspectors.Add(this);
     }
 }
Example #6
0
        internal static ClientRuntime BuildProxyBehavior(ServiceEndpoint serviceEndpoint, out BindingParameterCollection parameters)
        {
            parameters = new BindingParameterCollection();
            SecurityContractInformationEndpointBehavior.ClientInstance.AddBindingParameters(serviceEndpoint, parameters);

            AddBindingParameters(serviceEndpoint, parameters);

            ContractDescription contractDescription = serviceEndpoint.Contract;
            ClientRuntime clientRuntime = new ClientRuntime(contractDescription.Name, contractDescription.Namespace);
            clientRuntime.ContractClientType = contractDescription.ContractType;

            IdentityVerifier identityVerifier = serviceEndpoint.Binding.GetProperty<IdentityVerifier>(parameters);
            if (identityVerifier != null)
            {
                clientRuntime.IdentityVerifier = identityVerifier;
            }

            for (int i = 0; i < contractDescription.Operations.Count; i++)
            {
                OperationDescription operation = contractDescription.Operations[i];

                if (!operation.IsServerInitiated())
                {
                    DispatcherBuilder.BuildProxyOperation(operation, clientRuntime);
                }
                else
                {
                    DispatcherBuilder.BuildDispatchOperation(operation, clientRuntime.CallbackDispatchRuntime);
                }
            }

            DispatcherBuilder.ApplyClientBehavior(serviceEndpoint, clientRuntime);
            return clientRuntime;
        }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     foreach (var operation in endpoint.Contract.Operations)
     {
         DecorateFormatterBehavior(operation, clientRuntime);
     }
 }
		void IContractBehavior.ApplyClientBehavior (
			ContractDescription description,
			ServiceEndpoint endpoint,
			ClientRuntime proxy)
		{
			throw new NotImplementedException ();
		}
Example #9
0
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            ModuleProc PROC = new ModuleProc("AppNotifyServiceClientBehavior", "ApplyClientBehavior");

            try
            {
                if (_knownTypes == null)
                {
                    return;
                }
                foreach (OperationDescription od in endpoint.Contract.Operations)
                {
                    foreach (Type knownType in _knownTypes)
                    {
                        if (od.KnownTypes.IndexOf(knownType) == -1)
                        {
                            od.KnownTypes.Add(knownType);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="contractDescription"></param>
 /// <param name="endpoint"></param>
 /// <param name="clientRuntime"></param>
 public void ApplyClientBehavior(
     ContractDescription contractDescription,
     ServiceEndpoint endpoint,
     ClientRuntime clientRuntime)
 {
     // empty
 }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     if (clientRuntime != null && clientRuntime.CallbackDispatchRuntime != null && clientRuntime.CallbackDispatchRuntime.UnhandledDispatchOperation != null)
     {
         clientRuntime.CallbackDispatchRuntime.UnhandledDispatchOperation.Invoker = new UnhandledActionOperationInvoker();
     }
 }
        internal ImmutableClientRuntime(ClientRuntime behavior)
        {
            _channelInitializers = EmptyArray<IChannelInitializer>.ToArray(behavior.ChannelInitializers);
            _interactiveChannelInitializers = EmptyArray<IInteractiveChannelInitializer>.ToArray(behavior.InteractiveChannelInitializers);
            _messageInspectors = EmptyArray<IClientMessageInspector>.ToArray(behavior.MessageInspectors);

            _operationSelector = behavior.OperationSelector;
            _useSynchronizationContext = behavior.UseSynchronizationContext;
            _validateMustUnderstand = behavior.ValidateMustUnderstand;

            _unhandled = new ProxyOperationRuntime(behavior.UnhandledClientOperation, this);

            _addTransactionFlowProperties = behavior.AddTransactionFlowProperties;

            _operations = new Dictionary<string, ProxyOperationRuntime>();

            for (int i = 0; i < behavior.Operations.Count; i++)
            {
                ClientOperation operation = behavior.Operations[i];
                ProxyOperationRuntime operationRuntime = new ProxyOperationRuntime(operation, this);
                _operations.Add(operation.Name, operationRuntime);
            }

            _correlationCount = _messageInspectors.Length + behavior.MaxParameterInspectors;
        }
		void IEndpointBehavior.ApplyClientBehavior (ServiceEndpoint endpoint, ClientRuntime clientRuntime)
		{
			if (endpoint == null)
				throw new ArgumentNullException ("endpoint");
			if (clientRuntime == null)
				throw new ArgumentNullException ("clientRuntime");
		}
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     foreach (ClientOperation operation in clientRuntime.Operations)
     {
         operation.ParameterInspectors.Add(new ConsumerInspector());
     }
 }
		/// <summary>
		/// Injects the user agent into the service request.
		/// </summary>
		/// <param name="endpoint">The enpoint of the service for which to set the user-agent.</param>
		/// <param name="clientRuntime">The client runtime.</param>
		public override void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
		{
			base.ApplyClientBehavior(endpoint, clientRuntime);
			HttpUserAgentMessageInspector amiInspector = new HttpUserAgentMessageInspector(this.m_userAgent);
			clientRuntime.MessageInspectors.Add(amiInspector);

		}
        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {
            var protoBinding = endpoint.Binding as ProtoBufBinding;

            if (protoBinding == null)
                throw new ConfigurationException("The endpoint behaviour, ProtoBufBindingEndpointBehaviour, can only be applied to an endpoint which has ProtoBufBinding as its binding.");

            foreach (var clientOperation in clientRuntime.ClientOperations)
            {
                var compressionBehaviour = protoBinding.GetOperationCompressionBehaviour(clientOperation.Name);

                var contractInfo = ContractInfo.FromAction(clientOperation.Action);

                var serviceContract = TypeFinder.FindServiceContract(contractInfo.ServiceContractName);

                var paramTypes = TypeFinder.GetContractParamTypes(serviceContract, contractInfo.OperationContractName,
                                                                  contractInfo.Action, false);

                var formatter = new ProtoBufClientFormatter(new List<TypeInfo>(paramTypes), contractInfo.Action, 
                    compressionBehaviour);

                clientOperation.Formatter = formatter;
                clientOperation.SerializeRequest = true;
                clientOperation.DeserializeReply = true;
            }
        }
        void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
        {
            if (behavior == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("behavior"));

            behavior.ValidateMustUnderstand = this.ValidateMustUnderstand;
        }
		/// <summary>
		/// Injects the user agent into the service request.
		/// </summary>
		/// <param name="endpoint">The enpoint of the service for which to set the user-agent.</param>
		/// <param name="clientRuntime">The client runtime.</param>
		public override void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
		{
			base.ApplyClientBehavior(endpoint, clientRuntime);
			CookieMessageInspector cmiInspector = new CookieMessageInspector(m_dicAuthenticationCookies);
			clientRuntime.MessageInspectors.Add(cmiInspector);

		}
Example #19
0
		public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
		{
			foreach (var errorHandler in errorHandlers)
			{
				clientRuntime.CallbackDispatchRuntime.ChannelDispatcher.ErrorHandlers.Add(errorHandler);
			}
		}
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     foreach (ClientOperation operation in clientRuntime.Operations)
     {
         operation.ParameterInspectors.Add(new OperationProfilerParameterInspector(this.manager, operation.IsOneWay));
     }
 }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     var inspector=new ClientHeaderInspector();
     clientRuntime.ClientMessageInspectors.Add(inspector);
     foreach (var op in clientRuntime.Operations)
         op.ParameterInspectors.Add(inspector);
 }
Example #22
0
 public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
 {
     // here we add one "strategy" for handling SOAP messages
     // MS designed this using the "Template Pattern", so we are able to add a
     // specific behavior that will be called during the execution of webservice.
     behavior.MessageInspectors.Add (messageInspector);
 }
 void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
 {
     if (behavior == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("behavior");
     }
     behavior.Via = this.Uri;
 }
 void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
 {
     if (serviceEndpoint.Contract.SessionMode == SessionMode.Required)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxNoBatchingForSession")));
     }
     behavior.CallbackDispatchRuntime.ChannelDispatcher.MaxTransactedBatchSize = this.MaxBatchSize;
 }
        public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.ClientRuntime behavior)
        {
            //Add the inspector
            CustomMessageInspector cmi = new CustomMessageInspector();

            cmi.ReturnMessageXML += cmi_ReturnMessageXML;
            behavior.MessageInspectors.Add(cmi);
        }
 /// <summary>
 /// Implements a modification or extension of the client across a contract.
 /// </summary>
 public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint,
                                 ClientRuntime clientRuntime)
 {
     foreach (OperationDescription od in contractDescription.Operations)
     {
         InjectNetDataContractSerializer(od);
     }
 }
        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {
            string user = ConfigurationManager.AppSettings["User"];
            string password = ConfigurationManager.AppSettings["Password"];

            var inspector = new AuthenticationHeaderInspector {User = user, Password = password};
            clientRuntime.MessageInspectors.Add(inspector);
        }
Example #28
0
File: Element.cs Project: jcde/WCF
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     if (!string.IsNullOrEmpty(m_userAgent))
     {
         var inspector = new HttpUserAgentMessageInspector(m_userAgent);
         clientRuntime.MessageInspectors.Add(inspector);
     }
 }
 void IContractBehavior.ApplyClientBehavior(ContractDescription contract, ServiceEndpoint endpoint, ClientRuntime runtime)
 {
     //if (s_Logger.IsDebugEnabled)
     //{
     //    s_Logger.DebugFormat("Applying client ExceptionMarshallingBehavior to contract {0}", contract.ContractType);
     //}
     ApplyClientBehavior(runtime);
 }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
 {
     foreach(var operation in clientRuntime.Operations)
     {
         operation.ParameterInspectors.Add(
             new OperationTimingParamaterInspector(_invocationReporter, endpoint.Contract.Name));
     }
 }
 void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
 {
     ChannelDispatcher channelDispatcher = behavior.CallbackDispatchRuntime.ChannelDispatcher;
     if ((channelDispatcher != null) && this.includeExceptionDetailInFaults)
     {
         channelDispatcher.IncludeExceptionDetailInFaults = true;
     }
 }
 void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime runtime)
 {
     //if (s_Logger.IsDebugEnabled)
     //{
     //    s_Logger.DebugFormat("Applying client ExceptionMarshallingBehavior to endpoint {0}", endpoint.Address);
     //}
     ApplyClientBehavior(runtime);
 }
Example #33
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     foreach (ClientOperation clientOperation in clientRuntime.Operations)
     {
         clientOperation.ParameterInspectors.Add(
             new MyParameterInspector());
     }
 }
Example #34
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     clientRuntime.MessageInspectors.Add(new HawkClientMessageInspector(
                                             new HawkCredential
     {
         Id        = this.Id,
         Algorithm = this.Algorithm,
         Key       = this.Key
     }));
 }
Example #35
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     if (endpoint.Binding is XmlRpcHttpBinding)
     {
         foreach (OperationDescription opDesc in endpoint.Contract.Operations)
         {
             ReplaceFormatterBehavior(opDesc, endpoint);
         }
     }
 }
Example #36
0
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            var ticket = GetTicket();
            var insp   = new CustomAuthHeaderInspector(this.BindingType, ticket);

            lock (_inspectors)
            {
                _inspectors.Add(insp);
            }
            clientRuntime.MessageInspectors.Add(insp);
        }
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            CustomBinding binding = new CustomBinding(endpoint.Binding);
            TransportBindingElement tbe = binding.Elements.Find<TransportBindingElement>();
            tbe.ManualAddressing = false;
            endpoint.Binding = binding;

            foreach (OperationDescription opDesc in endpoint.Contract.Operations)
            {
                ReplaceFormatterBehavior(opDesc, endpoint);
            }
        }
Example #38
0
 public ServiceChannelFactory(System.ServiceModel.Dispatcher.ClientRuntime clientRuntime, Binding binding)
 {
     if (clientRuntime == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("clientRuntime");
     }
     this.bindingName    = binding.Name;
     this.channelsList   = new List <IChannel>();
     this.clientRuntime  = clientRuntime;
     this.timeouts       = new DefaultCommunicationTimeouts(binding);
     this.messageVersion = binding.MessageVersion;
 }
        private static void ApplyClientBehavior(System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            foreach (IClientMessageInspector messageInspector in clientRuntime.MessageInspectors)
            {
                if (messageInspector is CustomInspectorBehavior)
                {
                    return;
                }
            }

            clientRuntime.MessageInspectors.Add(new CustomInspectorBehavior());
        }
Example #40
0
        void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "ApplyClientBehavior");

            try
            {
                // on process the endpoint description
                this.OnEndpointClientBehavior(endpoint, clientRuntime);

                // on process the endpoint operations
                this.ProcessContractOperations(endpoint, true);
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
 public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.ClientRuntime behavior)
 {
     // Add the inspector
     behavior.MessageInspectors.Add(new CentralSessionClientMessageInspector(this.User, this.Password));
 }
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
 }
 /// <summary>
 /// Endpoint Add client behavior
 /// <para>Will add the client message inspector to this behavior</para>
 /// </summary>
 /// <param name="endpoint"></param>
 /// <param name="clientRuntime"></param>
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     clientRuntime.MessageInspectors.Add(new ClientMessageInspector());
 }
 void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     //JSONPSupportInspector inspector = new JSONPSupportInspector();
     //clientRuntime.MessageInspectors.Add(inspector);
 }
Example #45
0
 public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
 }
Example #46
0
        /// <summary>
        /// Enable custom message inspector
        /// </summary>
        /// <param name="endpoint"></param>
        /// <param name="clientRuntime"></param>
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            MessageInspector inspector = new MessageInspector(this.clientConfig, serviceName);

            clientRuntime.MessageInspectors.Add(inspector);
        }
Example #47
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     clientRuntime.MessageInspectors.Add(new MessageInspector(soapMessages, signingCertificate));
 }
Example #48
0
 /// <summary>
 /// ApplyClientBehavior():  This method will be used to add the
 /// ASAClientMessageInspector behavior to the MessageInspectors collection of
 /// the client-runtime of the client proxy.
 /// </summary>
 /// <param name="serviceEndpoint"></param>
 /// <param name="behavior"></param>
 public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.ClientRuntime behavior)
 {
     svcEndpoint = serviceEndpoint;
     _Log.InfoFormat("Adding ASAClientmessageInspector behavior to {0}", serviceEndpoint.Address.Uri);
     behavior.MessageInspectors.Add(this);
 }
 public void ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     ApplyInspectorsToRuntime(ref clientRuntime);
 }
Example #50
0
 public static ServiceChannelFactory BuildChannelFactory(ChannelBuilder channelBuilder, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     if (channelBuilder.CanBuildChannelFactory <IDuplexChannel>())
     {
         return(new ServiceChannelFactoryOverDuplex(channelBuilder.BuildChannelFactory <IDuplexChannel>(), clientRuntime, channelBuilder.Binding));
     }
     if (channelBuilder.CanBuildChannelFactory <IDuplexSessionChannel>())
     {
         return(new ServiceChannelFactoryOverDuplexSession(channelBuilder.BuildChannelFactory <IDuplexSessionChannel>(), clientRuntime, channelBuilder.Binding, false));
     }
     return(new ServiceChannelFactoryOverRequestSession(channelBuilder.BuildChannelFactory <IRequestSessionChannel>(), clientRuntime, channelBuilder.Binding, false));
 }
Example #51
0
 public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.ClientRuntime behavior)
 {
     behavior.MessageInspectors.Add(this.ClientMessageInspector);
 }
Example #52
0
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            HttpUserAgentMessageInspector inspector = new HttpUserAgentMessageInspector(_proc);

            clientRuntime.MessageInspectors.Add(inspector);
        }
Example #53
0
        public static ServiceChannelFactory BuildChannelFactory(ServiceEndpoint serviceEndpoint, bool useActiveAutoClose)
        {
            ChannelRequirements        requirements;
            BindingParameterCollection parameters;

            if (serviceEndpoint == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceEndpoint");
            }
            serviceEndpoint.EnsureInvariants();
            serviceEndpoint.ValidateForClient();
            ChannelRequirements.ComputeContractRequirements(serviceEndpoint.Contract, out requirements);
            System.ServiceModel.Dispatcher.ClientRuntime clientRuntime = DispatcherBuilder.BuildProxyBehavior(serviceEndpoint, out parameters);
            Binding binding = serviceEndpoint.Binding;

            System.Type[]  requiredChannels = ChannelRequirements.ComputeRequiredChannels(ref requirements);
            CustomBinding  binding2         = new CustomBinding(binding);
            BindingContext context          = new BindingContext(binding2, parameters);
            InternalDuplexBindingElement internalDuplexBindingElement = null;

            InternalDuplexBindingElement.AddDuplexFactorySupport(context, ref internalDuplexBindingElement);
            binding2 = new CustomBinding(context.RemainingBindingElements);
            binding2.CopyTimeouts(serviceEndpoint.Binding);
            foreach (System.Type type in requiredChannels)
            {
                if ((type == typeof(IOutputChannel)) && binding2.CanBuildChannelFactory <IOutputChannel>(parameters))
                {
                    return(new ServiceChannelFactoryOverOutput(binding2.BuildChannelFactory <IOutputChannel>(parameters), clientRuntime, binding));
                }
                if ((type == typeof(IRequestChannel)) && binding2.CanBuildChannelFactory <IRequestChannel>(parameters))
                {
                    return(new ServiceChannelFactoryOverRequest(binding2.BuildChannelFactory <IRequestChannel>(parameters), clientRuntime, binding));
                }
                if ((type == typeof(IDuplexChannel)) && binding2.CanBuildChannelFactory <IDuplexChannel>(parameters))
                {
                    if (requirements.usesReply && binding.CreateBindingElements().Find <TransportBindingElement>().ManualAddressing)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("CantCreateChannelWithManualAddressing")));
                    }
                    return(new ServiceChannelFactoryOverDuplex(binding2.BuildChannelFactory <IDuplexChannel>(parameters), clientRuntime, binding));
                }
                if ((type == typeof(IOutputSessionChannel)) && binding2.CanBuildChannelFactory <IOutputSessionChannel>(parameters))
                {
                    return(new ServiceChannelFactoryOverOutputSession(binding2.BuildChannelFactory <IOutputSessionChannel>(parameters), clientRuntime, binding, false));
                }
                if ((type == typeof(IRequestSessionChannel)) && binding2.CanBuildChannelFactory <IRequestSessionChannel>(parameters))
                {
                    return(new ServiceChannelFactoryOverRequestSession(binding2.BuildChannelFactory <IRequestSessionChannel>(parameters), clientRuntime, binding, false));
                }
                if ((type == typeof(IDuplexSessionChannel)) && binding2.CanBuildChannelFactory <IDuplexSessionChannel>(parameters))
                {
                    if (requirements.usesReply && binding.CreateBindingElements().Find <TransportBindingElement>().ManualAddressing)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("CantCreateChannelWithManualAddressing")));
                    }
                    return(new ServiceChannelFactoryOverDuplexSession(binding2.BuildChannelFactory <IDuplexSessionChannel>(parameters), clientRuntime, binding, useActiveAutoClose));
                }
            }
            foreach (System.Type type2 in requiredChannels)
            {
                if ((type2 == typeof(IOutputChannel)) && binding2.CanBuildChannelFactory <IOutputSessionChannel>(parameters))
                {
                    return(new ServiceChannelFactoryOverOutputSession(binding2.BuildChannelFactory <IOutputSessionChannel>(parameters), clientRuntime, binding, true));
                }
                if ((type2 == typeof(IRequestChannel)) && binding2.CanBuildChannelFactory <IRequestSessionChannel>(parameters))
                {
                    return(new ServiceChannelFactoryOverRequestSession(binding2.BuildChannelFactory <IRequestSessionChannel>(parameters), clientRuntime, binding, true));
                }
                if (((type2 == typeof(IRequestSessionChannel)) && binding2.CanBuildChannelFactory <IRequestChannel>(parameters)) && (binding2.GetProperty <IContextSessionProvider>(parameters) != null))
                {
                    return(new ServiceChannelFactoryOverRequest(binding2.BuildChannelFactory <IRequestChannel>(parameters), clientRuntime, binding));
                }
            }
            Dictionary <System.Type, byte> dictionary = new Dictionary <System.Type, byte>();

            if (binding2.CanBuildChannelFactory <IOutputChannel>(parameters))
            {
                dictionary.Add(typeof(IOutputChannel), 0);
            }
            if (binding2.CanBuildChannelFactory <IRequestChannel>(parameters))
            {
                dictionary.Add(typeof(IRequestChannel), 0);
            }
            if (binding2.CanBuildChannelFactory <IDuplexChannel>(parameters))
            {
                dictionary.Add(typeof(IDuplexChannel), 0);
            }
            if (binding2.CanBuildChannelFactory <IOutputSessionChannel>(parameters))
            {
                dictionary.Add(typeof(IOutputSessionChannel), 0);
            }
            if (binding2.CanBuildChannelFactory <IRequestSessionChannel>(parameters))
            {
                dictionary.Add(typeof(IRequestSessionChannel), 0);
            }
            if (binding2.CanBuildChannelFactory <IDuplexSessionChannel>(parameters))
            {
                dictionary.Add(typeof(IDuplexSessionChannel), 0);
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ChannelRequirements.CantCreateChannelException(dictionary.Keys, requiredChannels, binding.Name));
        }
Example #54
0
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            ConsoleOutputMessageInspector inspector = new ConsoleOutputMessageInspector();

            clientRuntime.MessageInspectors.Add(inspector);
        }
Example #55
0
 void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     clientRuntime.MessageInspectors.Add(new HMLRBGMessageInspector(m_Username, m_Password));
 }
Example #56
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     clientRuntime.MessageInspectors.Add(new PasswordDigestMessageInspector(this.Username, this.Password, this.DeviceTimeOffset));
 }
 public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     // this is a dispatch-side behavior which doesn't require
     // any action on the client
     return;
 }
Example #58
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     throw new Exception("Behavior not supported on the consumer side!");
 }
Example #59
0
 public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
 {
     clientRuntime.MessageInspectors.Add(new HeaderContextClientMessageInspector(m_IsWebHttpBinding));
 }
Example #60
0
        void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            CustomMessageInspector inspector = new CustomMessageInspector();

            clientRuntime.MessageInspectors.Add(inspector);
        }