1

Web 服务(asmx)——我必须使用——想要一个自定义的肥皂头。我尝试像这样添加 OperationContextScope Header:

ServiceReference1.WebServiceStructureSoapClient client = new ServiceReference1.WebServiceStructureSoapClient();

client.getSectorsCompleted += asd_getSectorsCompleted;

AuthHeader serviceCredential = new AuthHeader() { Username = "xxxx", Password = "yyyyy" };

using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
{
     MessageHeader header = MessageHeader.CreateHeader("AuthHeader", "http://mobilecampaigns.org/", serviceCredential,true);
     OperationContext.Current.OutgoingMessageHeaders.Add(header);
     client.getSectorsAsync("test", "test", "i", "test");
}

在服务器端,AutHeader 不为空,但用户名和密码为空。

任何想法?

谢谢

4

0 回答 0