Brief comparision:Soap VS Rest
Posted m1m-FG
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Brief comparision:Soap VS Rest相关的知识,希望对你有一定的参考价值。
目录
一、Soap
Soap (Simple Object Access Protocol) is a messaging protocol specification for exchanging structured information in the implementation of web services in the computer networks.
Therefore, (as soap is a protocol) it imposes some build-in rules that can add complexity and overhead, and also lead to long page load times.
The advantage of soap is safety. It supports not only SSL protocol (Secure Sockets Layer)(端到端加密), but also WS-Security protocol (WS = web services) which adds some enterprise security features.
In addition, it build-in the ACID characteristic of database to ensure the consistency and reliability of transactions. This is the reason why banks and payment system use soap.
二、Rest
Rest (Representational state transfer) is a set of web API architecture principles (or style) which suitable for lightweight web services and mobile applications.
The advantage of rest api is more flexible and easy to use.
三、Soap VS Rest
Soap | Rest | |
Concept | Messaging protocol specification. | Web api architecture principles (style). |
Concept | Make data available as services(operation). Eg: GetUserInfo. | Make data available as resources. Eg: UserInfo. |
Services | Back-end services. | Front-end services |
Returned messages type | XML only | XM, html, JSON, PDF, Text, etc. |
Communi- cation methos | HTTP, TCP, Web Sockets, etc. | HTTP only. |
Message patterns | Request-reply, one-way. | Request-reply only. |
Cons | 1. Soap consume more bandwidth. 2. Take much effort to implement and is not good for integrate between Web and mobile developers. | 1. Less security. 2. Based on Http protocol only. |
Security | Supports both SSL security and WS-security, which adds some enterprise security features. | Support only point-to-point SSL security. |
Cache | Not support data caches. | Support data caches. |
Reference:
【大厂面试】面试官:你连RESTful都不知道我怎么敢要你?
REST vs SOAP, the difference between soap and rest
使用 gSOAP 进行 VS 2003/C++ 访问具有 WS-Security 的 SOAP Web 服务?
【中文标题】使用 gSOAP 进行 VS 2003/C++ 访问具有 WS-Security 的 SOAP Web 服务?【英文标题】:Use gSOAP for VS 2003/C++ access to SOAP Web Service with WS-Security? 【发布时间】:2009-10-07 17:44:42 【问题描述】:我们有一个即将推出的项目,允许只能使用 C++/VS 2003 扩展的旧平台调用使用 WS-Security 的基于 SOAP 的 Web 服务。
我的 Google 研究表明,gSOAP 可能是最好的选择。
我正在寻找验证和/或替代建议。
【问题讨论】:
【参考方案1】:我一直在使用 gSoap 和 WS-Security 的 wsse 插件,在 Windows 和 Linux 的客户端和服务器端都使用签名。花了一些时间,但效果很好。它也非常快。
它将要求您将 OpenSSL 与您的项目相关联。实际上,我在几个版本的 wsse 插件中发现了一个错误,该错误涉及直接调用 OpenSSL 以进行签名生成和验证。所有的错误都涉及泄漏 OpenSSL 结构。 (修复已被源代码树接受,并且是当前版本的一部分。)
总的来说,上手真的没有那么难。我使用 SoapUI (http://www.soapui.org/) 对签名生成进行故障排除,以验证我是否做错了什么或远程端是否有问题。
如果您在 Apache2 下进行服务器端 WS-Security,则必须坚持使用 gSoap 附带的 mod_gsoap 0.6。我不得不对其进行一些修改,因为默认情况下它不会处理 WS-Security。
我相信,但没有做很多调查,有人破坏了 SourceForge 当前版本的 mod_gsoap 0.7。我花了一段时间才发现 0.7 是 apache2 的段错误,所以也许这会为你省点麻烦。
【讨论】:
以上是关于Brief comparision:Soap VS Rest的主要内容,如果未能解决你的问题,请参考以下文章
java First_Number_Second_Number__Equal_Comparision
使用 gSOAP 进行 VS 2003/C++ 访问具有 WS-Security 的 SOAP Web 服务?
python使用matplotlib可视化不同年份不同项目的均值(mean)对比条形图(bar plot comparision of mean with different years)