博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【转】REST and SOAP are not interchangable in hand
阅读量:6948 次
发布时间:2019-06-27

本文共 2376 字,大约阅读时间需要 7 分钟。

hot3.png

Recently I saw this question posted in a forum: “Does REST have better performance than SOAP”?

This question is symptomatic of a fundamental misunderstanding of REST, I think. SOAP is a particular protocol used to implement RPC functionality. REST, on the other hand, is not a technology or protocol, but an architectural style. Systems that were built with the REST architectural style are fundamentally different from RPC based systems. For REST, we think in resources and data. For RPC we think in methods and actions. You can’t just swap one out for the other, because they are not even in the same category of things.

Comparing the performance of REST to SOAP is like asking: “What tastes better? ‘Stir fried’ or ‘zucchini’?” or “Which one is better? ‘Darth Vader’ or ‘Star Trek’?” Those question just don’t make any sense. People who think that they do are probably the same who think that REST is nothing but “RPC via URI”, which of course it is not.

You can ask whether a RESTful system, using HTTP as protocol, would have certain advantages or disadvantages compared to an RPC based system, using SOAP (over HTTP) as protocol. And even then you need to look at the system you are trying to implement and its specific requirements.

As far as performance is concerned: You can’t just say that “REST is faster/slower than SOAP”, since the two systems you deal with exhibit entirely different usage patterns and underlying architectures. If you talk about network connections, latency, use of additional libraries and stacks in that context, you still think that there is a 1:1 mapping somehow. You need to set all of that aside. Instead, to compare performance you first need to take a step back:

  • Ask yourself whether your system can be implemented as an RPC based system? Can it also be implemented as a resource oriented system? If so, which approach is more natural to the problem at hand?
  • Which of these two would result in a more natural work flow for you and your clients?
  • Does one of them offer other benefits (scalability, reliability, etc.) aside from those concerns?
  • Which of all of these things is most important to you?

The answers to these questions need to be considered. It’s certainly not as simple as asking if “REST has better performance than SOAP”. The two are not interchangeable like engines in a car.

转载于:https://my.oschina.net/aiguozhe/blog/37313

你可能感兴趣的文章
ZeroClipboard实现多个浏览器兼容的复制文本到剪贴板的功能
查看>>
动态SQL、绑定变量、静态SQL的性能对比
查看>>
还没学到的技术总不想先去偷窥,时机成熟才敢去解开神秘的面纱。
查看>>
因特尔:视网膜屏将于2013年到来
查看>>
VC删除注册表键值项
查看>>
Hadoop安装配置使用
查看>>
1.01 与 37.8
查看>>
微积分35--二重积分的计算
查看>>
java对象与字符串之间的序列化和反序列化
查看>>
人工智障 2 : 你看到的AI与智能无关
查看>>
Let's Encrypt 使用教程,免费的SSL证书,让你的网站拥抱 HTTPS
查看>>
.net 面试题系列四(附答案)
查看>>
sql server的并发性
查看>>
windows php启动浏览器
查看>>
CPP_类模板与模板类
查看>>
用CocoaPods做iOS程序的依赖管理
查看>>
gallery图片展示(图片间隔)
查看>>
[下一个话题]利用NodeJs+Html5+WebSocket快速构建即时在线简易PPT
查看>>
如何在Exchange Server 2007集线器传输服务器角色上使用防垃圾邮件功能
查看>>
Redis持久化相关问题
查看>>