asp.net – 在WCF代理中实现Ws-security
发布时间:2020-12-16 09:58:05 所属栏目:asp.Net 来源:网络整理
导读:我已将基于轴的wsdl导入到VS 2008项目中作为服务引用. 我需要能够传递用户名/密码和nonce值等安全性详细信息来调用基于轴的服务. 我已经考虑过为wse做这件事,我理解世界讨厌(没有问题) 我对WCF的经验很少,但是现在已经研究了如何物理调用端点,感谢SO,但是不
我已将基于轴的wsdl导入到VS 2008项目中作为服务引用.
我需要能够传递用户名/密码和nonce值等安全性详细信息来调用基于轴的服务. 我已经考虑过为wse做这件事,我理解世界讨厌(没有问题) 我对WCF的经验很少,但是现在已经研究了如何物理调用端点,感谢SO,但是不知道如何设置SoapHeaders,如下面的架构所示: <S:Envelope xmlns:S="http://www.w3.org/2001/12/soap-envelope" xmlns:ws="http://schemas.xmlsoap.org/ws/2002/04/secext"> <S:Header> <ws:Security> <ws:UsernameToken> <ws:Username>aarons</ws:Username> <ws:Password>snoraa</ws:Password> </ws:UsernameToken> </wsse:Security> ??? </S:Header> ??? </S:Envelope> 任何帮助非常感谢 谢谢,马克 解决方法
为了调用这些服务,通常使用basicHttpBinding(没有WS- *实现的SOAP 1.1)或wsHttpBinding(SOAP 1.2,带WS- *实现).
主要问题是正确获取所有安全参数.我有一个类似的Web服务(基于Java),我需要调用 – 这是我的设置和代码: app./web.config <system.serviceModel> <bindings> <basicHttpBinding> <binding name="SoapWithAuth" useDefaultWebProxy="false"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Basic" proxyCredentialType="None" realm="" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint name="SoapWithAuth" address="http://yourserver:port/YourService" binding="basicHttpBinding" bindingConfiguration="SoapWithAuth" contract="IYourService" /> </client> </system.serviceModel> 然后在调用服务时在客户端的代码中,您需要以下代码片段: IYourServiceClient client = new IYourServiceClient(); client.ClientCredentials.UserName.UserName = "username"; client.ClientCredentials.UserName.Password = "top-secret"; 这些帮助有用? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – SOAP 1.2在SOAP 1.1工作时产生错误请求
- asp.net – 如何停止RadioButtonList标签文本从按钮下包装
- asp.net – 为特定页面指定MaxHttpCollectionKeys?
- asp.net-mvc-3 – MVC 3使用RenderPage更改视图中的模型
- asp.net-mvc – MVC4捆绑使用Scripts.Render时速度慢
- asp.net-mvc – Spark视图引擎中的HTML注释
- asp.net-mvc – 如何将Bootstrap下拉式样应用于ASP.NET MVC
- ASP.Net Core MVC中的OutputCache
- asp.net – RESTful验证密码服务
- asp.net-web-api2 – 创建新的IHttpActionResult动作结果方