ClientRuntime.MessageInspectors Property

 

Gets a collection of message inspector implementations for a client.

Namespace:   System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

Public ReadOnly Property MessageInspectors As SynchronizedCollection(Of IClientMessageInspector)

Use the MessageInspectors property to attach custom IClientMessageInspector implementations to inspect or modify all messages that flow through the client.

In the following code example an System.ServiceModel.Description.IEndpointBehavior inserts a System.ServiceModel.Dispatcher.IClientMessageInspector into the client runtime by adding it to the MessageInspectors property.

#Region "IEndpointBehavior Members"
       Public Sub AddBindingParameters(ByVal endpoint As ServiceEndpoint, ByVal bindingParameters _
                                       As BindingParameterCollection) Implements IEndpointBehavior.AddBindingParameters
           Return
       End Sub

       Public Sub ApplyClientBehavior(ByVal endpoint As ServiceEndpoint, ByVal clientRuntime As ClientRuntime) _
       Implements IEndpointBehavior.ApplyClientBehavior
           clientRuntime.MessageInspectors.Add(New Inspector())
           For Each op As ClientOperation In clientRuntime.Operations
               op.ParameterInspectors.Add(New Inspector())
           Next op
       End Sub

       Public Sub ApplyDispatchBehavior(ByVal endpoint As ServiceEndpoint, ByVal endpointDispatcher As  _
                                        EndpointDispatcher) Implements IEndpointBehavior.ApplyDispatchBehavior
           endpointDispatcher.DispatchRuntime.MessageInspectors.Add(New Inspector())
           For Each op As DispatchOperation In endpointDispatcher.DispatchRuntime.Operations
               op.ParameterInspectors.Add(New Inspector())
           Next op
       End Sub

Public Sub Validate(ByVal endpoint As ServiceEndpoint) Implements IEndpointBehavior.Validate
	Return
End Sub

The following code example shows a configuration file that loads the endpoint behavior into the client endpoint.

.NET Framework
Available since 3.0
Silverlight
Available since 4.0
Return to top
Show: