先从SoapHeader继承一个自定义类CredentialSoapHeader,该类包含用户名和密码:


















在WebService类里面创建一个属性Credentials,类型为CredentialSoapHeader:













在WebMethod的方法上使用SoapHeader标识,成员名称为"Credentials":







public class SecurityHelper
{
// verifies the clients credentials
public static void VerifyCredentials(IssueVisionServices service)
{
String userName = service.Credentials.Username;
String password = service.Credentials.Password;
// 按照userName 和 password 进行授权验证

}
}
{
// verifies the clients credentials
public static void VerifyCredentials(IssueVisionServices service)
{
String userName = service.Credentials.Username;
String password = service.Credentials.Password;
// 按照userName 和 password 进行授权验证

}
}
二、客户端对Web Service的调用



















