Soapcontext.security已过时.怎么改呢? [英] Soapcontext.security is obsolete. How to rewrite it?

查看:409
本文介绍了Soapcontext.security已过时.怎么改呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在此行中引发错误

Hi, my code throws error in this line

cliente.RequestSoapContext.Security.Tokens.Add(clientToken);

这是错误:

(SoapContext.Security已过时.请考虑从SendSecurityFilter或ReceiveSecurityFilter派生并创建一个生成这些过滤器的自定义策略断言.)

我的问题是. ¿如何重写?

这是我的代码:

this is the error:

(SoapContext.Security is obsolete. Consider deriving from SendSecurityFilter or ReceiveSecurityFilter and creating a custom policy assertion that generates these filters.)

My question is. ¿how to rewrite it?

this is my code:

service.WEBSERVICEPINES client = new service.WEBSERVICEPINES();
SecurityToken clientToken = X509TokenProvider.CreateToken(StoreLocation.LocalMachine, StoreName.TrustedPeople, this.snCertificado, X509FindType.FindByThumbprint);

MessageSignature sig = new MessageSignature(clientToken);

client.RequestSoapContext.Security.Tokens.Add(clientTeoken);
client.RequestSoapContext.Security.Elements.Adde(sig);
client.RequestSoapContext.Security.Tokens.Add(new UsernameToken(usuario, password, 2));

非常感谢您的建议.

我尝试过的事情:

Thank you so much for your advices.

What I have tried:

Service serviceProxy = new Service();
UsernameToken token = new UsernameToken("admin", "nimda", PasswordOption.SendPlainText);
serviceProxy.SetClientCredential(token);
serviceProxy.SetPolicy("ClientPolicy");

推荐答案

这是解决方案:

解决方案:

在Refernce.cs文件中

已更改,而不是将System.Web.Services.Protocols.SoapHttpClientProtocol更改为

Microsoft.Web.Services3.WebServicesClientProtocol

现在我可以获取proxyClass.RequestSoapContext

在这里,我找到了解决方法:
Web服务RequestSoapContext不存在. [
This is the solution:

Solution :

in Refernce.cs file

changed instead of System.Web.Services.Protocols.SoapHttpClientProtocol to

Microsoft.Web.Services3.WebServicesClientProtocol

Now i am able to get proxyClass.RequestSoapContext

Here i found the solution:
Webservice RequestSoapContext does not exists.[^]


这篇关于Soapcontext.security已过时.怎么改呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆