Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.ServiceModel.Description;
namespace RoyalMail
{
public class EndPointBehaviour: IEndpointBehavior
{
RoyalMailHeaderCredentials _credentials;
public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
{
var inspector = new ClientMessageInspector();
inspector.SetCredentials(_credentials);
clientRuntime.MessageInspectors.Add(inspector);
}
public void SetCredentials(string clientId, string secret)
{
_credentials = new RoyalMailHeaderCredentials
{
ClientID = clientId,
Secret = secret
};
}
public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters){}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) {}
public void Validate(ServiceEndpoint endpoint) {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment