添加SOAP头在.NET中的web服务 [英] Add soap header to a webservice in .net
本文介绍了添加SOAP头在.NET中的web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图访问一个Web服务在我的.NET aplication,但web服务需要的凭据。 我如何添加SOAP头在.net中? web服务的NO-.net web服务。
I am trying to access to a webservice in my .net aplication, but the webservice needs credentials. how can i add the soap header in .net? the webservice in a NO-.net webservice.
推荐答案
可以做这样的事?
using (var service = new YourWebService())
{
service.PreAuthenticate = true;
service.UseDefaultCredentials = false;
service.Credentials = new NetworkCredential(UserName, Password);
var response = service.SomeMethod();
}
这篇关于添加SOAP头在.NET中的web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文