与 BasicHttpBinding 相比,何时使用 WSHttpBinding

When to utilize WSHttpBinding in compariosn with BasicHttpBinding

我刚刚开始使用 SOAP Web 服务,偶然发现了 WSHttpBinding 和 BasicHttpBinding。

我想根据以下用例了解两件事:

假设有一个 Web 服务接受国家名称作为请求,returns 州列表作为响应。

根据我上面的简单用例,WSHttpBinding 或 BasicHttpBinding 的优缺点是什么?

引用 WCF Soap Rest WSHTTPBinding

Between basicHttpBinding and wsHttpBinding, there differences are as follows:

basicHttpBinding is the very basic binding - SOAP 1.1, not much in terms of security, not much else in terms of features - but compatible to just about any SOAP client out there --> great for interoperability, weak on features and security

wsHttpBinding is the full-blown binding, which supports a ton of WS-* features and standards - it has lots more security features, you can use sessionful connections, you can use reliable messaging, you can use transactional control - just a lot more stuff, but wsHttpBinding is also a lot *heavier" and adds a lot of overhead to your messages as they travel across the network

简单地说,WsHttpBinding 支持 WS-* 规范。 WS-* 规范是扩展 Web 服务功能的标准。另一个很大的区别是 Basic 默认以纯文本形式发送数据,其中 WS 支持安全和加密。

关于您的用例,如果您是一个非常有安全意识的个人和编码员,就像我们都应该努力成为的那样,并且您的国家和州的 Web 服务应该受到保护 - 使用 WSHTTPBinding 可能是个好主意,但恕我直言这会将您锁定在 WCF 和 .Net 中。如果您确实想走那条路并利用 WS 和 WCF,这篇 SO 文章解释了如何修改互操作的绑定设置