post方式调用带[SoapHeader("header")]的webservice方法

想做一个webservice身份验证,服务端通过用户名和密码验证客户端是否有权

限访问该接口。
下面是网上找的用c#写的服务端代码,我不想用添加引用的方式调用,请问
用post方式调用webservice,如何将客户端的username和password传到SoapHeader中呢,代码该怎么写呢?

//类

public class CustomSOAPHeader : SoapHeader  {

public CustomSOAPHeader()
{

}   

public string name;

public string password;

//这是方法
public bool IsValid
(string strUserName, string strPassword)

{

if
(strUserName == "admin" && strPassword == "admin")

return true;

else   

return false;   

} 

}

public CustomSOAPHeader header;

[SoapHeader("header")]

[WebMethod(Description = "测试", EnableSession = true)]

public string GetProduct(string Id)

{

if
(header.IsValid(header.name, header.password))   

return "验证成功";   

return "验证失败";

}

https://blog.csdn.net/u012995964/article/details/54562111