Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[iPhone and Web Services]: REST vs SOAP

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 site (for "standard" users);
  • web service (for mobile connections), based on TomCat and Axis2;
  • mySQL DB to storage users data.

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?

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?

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.

like image 570
Maury Avatar asked Dec 07 '09 10:12

Maury


2 Answers

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.

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.

like image 181
Kendall Helmstetter Gelner Avatar answered Nov 15 '22 00:11

Kendall Helmstetter Gelner


You can definitely do SOAP on the iPhone. Here is a nice tutorial on the subject. After all, SOAP is a HTTP based protocol and you have all the libraries you need to do HTTP on the iPhone.

Having said that, RESTful APIs are simpler than SOAP, so you might want to consider them. They're also HTTP based so you won't have any problems on doing that on iPhone. On the server side, if you use Java, you will have to use JAX-RS to implement that part.

Hope it helps.

like image 24
Pablo Santa Cruz Avatar answered Nov 14 '22 22:11

Pablo Santa Cruz