[iPhone和Web服务]:REST与SOAP [英] [iPhone and Web Services]: REST vs SOAP

查看:98
本文介绍了[iPhone和Web服务]:REST与SOAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始了我的学位项目,一个适用于iPhone,Android和(在不久的将来)Symbian的移动应用程序。服务器架构如下:

I've started my degree project, a mobile application suitable for iPhone, Android and (in the near future) Symbian. The server architecture is the following:


  • 网站(对于标准用户);

  • Web服务(用于移动连接),基于TomCat和Axis2;

  • mySQL数据库到存储用户数据。

在网上浏览,我已经阅读了很多关于iPhone和Web服务之间互动的讨论,我要说我不清楚我能做什么和不做什么。
让我们从用于从数据库检索数据的协议开始:Android端应用程序使用SOAP协议,我可以用iPhone做同样的事情吗?是否有一些限制或问题?

Surfing across the web, I've read a lot of discussion about the interaction between the iPhone and Web Services, and I've to say that I've not a clear idea of what I can do and what not. Let's start from the protocol used to retrieve data from the DB: the Android-side application uses SOAP protocol, can I do the same with iPhone? Are there some limitations or problems?

我还读过有关REST而不是SOAP的使用,是否可以使用上述服务器架构?哪些是主要的优点/缺点?

I have also read about the using of REST instead of SOAP, could it be possible with the server architecture described above? Which are the main advantages/disadvantages?

对不起,如果这些问题听起来像n00b,但这是我第一次使用iPhone的真实体验以及网上发现的大量信息在我的脑海里,我害怕被困惑。原谅我的任何错误。

Sorry if these questions sound "n00b", but it's my first real experience with iPhone and the lot of informations found on the web messed up my mind and I'm scared to be confused. Forgive me for any error.

推荐答案

SOAP对移动通信来说太沉重了。为什么要在一个额外的XML层中包装请求的所有工作都需要解析?您发送的数据超出了您的需要,并且会给客户端和服务器带来更大的CPU负担。

SOAP is simply too heavy for mobile communications. Why do all the work to wrap requests in an additional XML layer you'll have to parse? You send more data than you need to, and impose greater CPU burden on client and server.

使用REST。如果您正在进行跨平台项目,JSON会生成一个很好的有效负载容器,否则plist可以很好地从服务器发送数据。

Use REST. If you are doing a cross-platform project JSON makes a great payload container, otherwise plists work well for sending data from the server.

这篇关于[iPhone和Web服务]:REST与SOAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆