Last active
October 28, 2015 00:11
-
-
Save cmatskas/1a1fad97f9c5bd6e4355 to your computer and use it in GitHub Desktop.
Custom IEndpointBehavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ServiceModel.Description; | |
using System.ServiceModel.Dispatcher; | |
namespace APIServiceConsumer.Services | |
{ | |
public class CustomInspectorBehavior : IEndpointBehavior | |
{ | |
private readonly ClientMessageInspector clientMessageInspector = new ClientMessageInspector(); | |
public string LastRequestXml | |
{ | |
get { return clientMessageInspector.LastRequestXml; } | |
} | |
public string LastResponseXml | |
{ | |
get { return clientMessageInspector.LastRequestXml; } | |
} | |
public void AddBindingParameters( | |
ServiceEndpoint endpoint, | |
System.ServiceModel.Channels.BindingParameterCollection bindingParameters) | |
{ | |
} | |
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) | |
{ | |
} | |
public void Validate(ServiceEndpoint endpoint) | |
{ | |
} | |
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) | |
{ | |
clientRuntime.MessageInspectors.Add(clientMessageInspector); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed bad reference to the wrong class. Updated now to use the correct MessageInspector