jquery - 如何在 JQuery 端实现 WS-Security?

标签 jquery wcf soap wcf-binding wshttpbinding

我关注了这个代码项目sample .
使用 JQuery 中的 wsHttpBinding 公开的服务部分中写道:

A service exposed with “wsHttpBinding” binding implements WS-Security of WS-* family of web service specifications. As the binding uses security, the request will be rejected. The service cannot be called without implementing WS-Security at JQuery end. So, in order to call the service method, we have to compromise with the security.

他们正在实现一个不安全的 <wsHttpBinding>端点。

但我想要我的<wsHttpBinding>将是<security mode="Message"> ,
这个偏离路线不起作用并返回以下错误:

The message could not be processed. This is most likely because the action 'http://www.enghouse.com/CosmoCom/WebAdminAPIServiceLibrary/IQueue/GetAllQueues' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

如果我将其更改为 <security mode="None">它工作得很好。

所以我的问题是如何实现 <security mode="Message">
我需要做什么?

谢谢!

最佳答案

Check out Ws.js 。它是一个帮助实现 ws-security 的 JavaScript 库。

就我个人而言,只有当我必须将 Web 客户端与我没有源代码的现有 WCF 服务集成时,我才会这样做。如果没有任何额外的好处,维护 Web 客户端的 SOAP 协议(protocol)和 WCF 安全性的开销太大。如果您控制此服务的源,我将使用 ASP.NET Web API 为 Web 客户端提供 REST API并使用具有 HTTP 基本安全性的 SSL。

关于jquery - 如何在 JQuery 端实现 WS-Security?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13249675/

相关文章:

javascript - 如何让 Bootstrap 3 中的警报淡出?

javascript - 使用 jquery 向下滚动后表未固定在顶部

具有 WCF 数据的 WPF 应用程序 - EF、Linq2Sql 或 WCF 数据服务 - 无似乎 'Easy'

安卓 SOAP IOException "BufferedInputStream is closed"

java - 尝试查找 com.predic8.wsdl.WSDLParser 类所在的 jar

javascript - 如何使用 jQuery/Javascript 缩放单个 SVG 元素?

wcf - 在 WCF-netTCPBinding 中测试 TLS 安全性

asp.net - BuildManager.GetReferencedAssemblies 等效于非 Web 应用程序

java - 解码非强制 ENUM @XmlElement

jquery - 使数据适合屏幕……使输出响应