在与 python 进行客户端-服务器应用程序通信时使用什么协议?
我需要做一个客户端-服务器应用程序,客户端将使用 python-gtk 制作, 所有过程都将在服务器端进行,以减轻客户端的工作负载。
所以我在 google 上搜索了有关客户端-服务器协议的信息,我发现 CORBA 和 RPC 更接近我的想法,但我也想让这个应用程序准备好接受 Web 和移动客户端,所以我找到了 REST 和 SOAP。
从所有的阅读中,我发现自己有这样的疑问,我是否应该实现两种不同的协议,一种用于 gtk-client(如 RPC 或 CORBA),另一种用于 Web 和移动(REST 或 SOAP)?
我可以全部使用 REST 或 SOAP 吗?
I need to do a client-server application, the client will be made with python-gtk,
all procedures will be on server-side to free the client of this workload.
So i did search on google about client-server protocols and i found that CORBA and RPC are closer from what i had in mind, BUT also i want to made this app ready to accept web and mobile clients, so i found REST and SOAP.
From all that reading i found myself with this doubts, should i implement two different protocols, one for gtk-client (like RPC or CORBA) and another for web and mobile (REST or SOAP)?
Can i use REST or SOAP for all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我之前已经使用 SOAP/XMLRPC 实现了 Web 服务(支持两者很容易,我当时使用的框架使其变得非常简单);我曾考虑过使用不带 SOAP/XMLRPC 层的标准 HTTP(在我意识到 REST 有一个名字之前:),但最终决定不这样做,因为“我不想编写客户端代码来处理数据结构” 。 (Perl 客户端也有简单的 SOAP/XMLRPC API。)
最后,我对自己做出的决定感到后悔:我本可以在一个下午(或最多一天)内自己编写处理数据结构的代码——或者如果我选择使用 JSON,大概需要两个小时。但是,在我节省了几个小时的开发时间之后的几年里,SOAP/XMLRPC API 和库依赖项的负担仍然存在,并且将继续成为产品未来开发的负担。
因此,我建议在使用 RPC 框架之前先对 REST 进行一次非常好的尝试。
I've implemented webservices using SOAP/XMLRPC (it was easy to support both, the framework I was using at the time made it pretty trivial) before; I had thought about using standard HTTP without the SOAP/XMLRPC layer (before I was aware that REST had a name :) but decided against it in the end because "I didn't want to write client-side code to handle the datastructures". (The Perl client also had easy SOAP/XMLRPC APIs.)
In the end, I regretted the decision I made: I could have written the code to handle the datastructures myself in an afternoon (or at the most a day) -- or if I had chosen to use JSON, probably two hours. But the burden of the SOAP/XMLRPC API and library dependencies lives on, years after I saved a few hours of developing, and will continue to be a burden for future development of the product.
So I recommend giving REST a really good try before going with an RPC framework.
使用休息。它是最简单的,因此也是最广泛使用的。如果您稍后确实需要 SOAP、RPC 或 CORBA,则可以添加它们。
Use REST. It's the simplest, and therefore the most widely accessible. If you really find a need for SOAP, RPC, or CORBA later, you can add them then.