public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel) { UsernameToken token = new UsernameToken(this.Username, this.Password); // Serialize the token to XML XmlElement securityToken = token.GetXml(new XmlDocument()); MessageHeader securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", securityToken, false); request.Headers.Add(securityHeader); // complete return Convert.DBNull; }
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel) { UsernameToken token = new UsernameToken(this.Username, this.Password); // Serialize the token to XML XmlElement securityToken = token.GetXml(new XmlDocument()); MessageHeader securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", securityToken, false); request.Headers.Add(securityHeader); // complete return(Convert.DBNull); }