You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
768 B

using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
namespace EC.Onvif.Security
{
public class SoapSecurityHeaderInspector : IClientMessageInspector
{
readonly string username;
readonly string password;
readonly TimeSpan time_shift;
public SoapSecurityHeaderInspector(string username, string password, TimeSpan timeShift)
{
this.username = username;
this.password = password;
time_shift = timeShift;
}
public void AfterReceiveReply(ref Message reply, object correlationState)
{
}
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
request.Headers.Add(new SoapSecurityHeader(username, password, time_shift));
return null;
}
}
}