iPhone dealing with xml vs soap vs JSON vs RESTful - iphone

I do not have much experience coding systems dealing with web-services. Please help me in solving following confusion.
One of my clients want me to build an iPhone App that had native UI controls but deals extensively with Web Services. Right from authenticating the user into a network to loading a list of users or anything related in the app will need to talk to a web service.
They have web services deployed on .NET on the server side and already have required data in SOAP web service. By doing some basic research on the web it seems that dealing with SOAP from an iPhone app could be messy and affect performance.
The client is ready to make the data available in from of JSON or plain XML data. I am not sure which one would be a better option? The data could range from few tens to few hundreds of rows only.
Can someone please point me how can I do a comparative study in short period of time (3-4 days) even if it takes for me to learn about the SOAP, XML, JSON and REST web services. Is this even possible or should I just go with some expert advice? - Waiting for expert advice :)
Thanks

XML and JSON are data interchange formats. JSON is generally considered easier to work with, although a good library should make both palatable.
REST is an architectural style; it is the architectural style that HTTP is designed to support.
SOAP is a protocol for implementing web services, and it does not follow the REST architectural style; it's more of an Remote Procedure Call style.
I dislike SOAP because it forces you to rely on tools to manage many of its facets. If your tools happen to work differently than the tools used by the other end, then it becomes extremely painful.
I recommend reading RESTful Web Services for a general overview of REST, and why it's "better" than SOAP.
I don't have any good resources for SOAP, or anything iPhone specific.

RESTFul webservices can return responses in XML or in JSon, the option of using such service is better than soap for iphone because of the overhead involved with soap as you mentioned. Basically when u get responses in xml or json its just some text that you need to parse. I would recommend going with Json as there are json parser libraries for iphone out there already and its very simple to use...Here is a tutorial for using the json parser and parsing your responses, Json tutorial...hope it helps

Related

SOAP vs REST, when to use one and not the other?

I'm really confused everytime I come around this question, what characteristics would help one choosing SOAP over REST or the other way around?
I mean, besides the fact that REST has a compact format compared to SOAP, and the other "minor" or "technical" differences, what are the "obvious" differences that make one of them more suitable for a project and not the other?
Just for the record, I have read all of the other questions (1|2|3|4) regarding this matter on Stack Overflow, and not one of them answered my question.
The difference between REST and SOAP is fundamental, yet they're not that dissimilar. Ultimately, you still need to transfer exactly the same information in order to perform a particular abstract operation. It's entirely easy to make REST rather low-performing by choosing poorly what information to return, and SOAP with MTOM can transfer large binary chunks efficiently. There's even the possibility to use non-XML encodings and connected transports (e.g., XMPP) with SOAP that can make it more efficient than REST.
So don't worry about that!
A much more relevant thing to think about is that SOAP continues to have significantly more advanced tooling support in some languages, and that other languages strongly prefer REST. For example, if you want a Java client for your service, you'll be able to get going with SOAP in minutes: just put the WSDL location through a tooling engine and you've got yourself a basic client. On the other hand, if you're working with a Javascript client then you'll absolutely prefer to deal with the REST interface; Javascript works great with REST.
A key thing to note here is that you can have your service support both SOAP and REST at once (you might need to put them on different endpoints, but that's not very onerous). I do this with a service I support (using Java and Apache CXF) and the overhead of doing both is minimal: the key is that I need a clean abstract interface behind the scenes that both the SOAP and REST interfaces use.
If you just want a simple, visual guide to help you measure SOAP and REST against your applications requirements...
Vijay Prasad Gupta has put together a simple, helpful flow-chart.
Direct link to flow chart:
https://drive.google.com/file/d/0B3zMtAq1Rf-sdVFNdThvNmZWRGc/edit
Link to article:
https://www.linkedin.com/pulse/20140818062318-7933571-soap-vs-rest-flowchart-to-determine-the-right-web-services-protocol-for-your-needs
SOAP is a form of RPC and REST is architecture style that can scale with the web.
REST concerns about the following (copied from RESTful Web Services)
Addressability
Statelessness
Representations
Links and Connectedness
The Uniform Interface
Two great books on REST and have some discussions on the topic that you are interested in.
REST in Practice
Restful Web Services

How to consume ASPX webservices in iOS?

Could anybody clarify the process of consuming aspx webservices in iOS? I have already tried JSON framework but now, need to create an app that consumes .net webservices in XML format. I need both to post some data to, and get data from the server. I already read about existing XML parsers for iOS that I found (here)
The question is do I need to do additional setup, like wrapping my query strings in SOAP or smth, in order to communicate with webserver? Would it be sufficient to use only one of mentioned libraries in the link or do I need additional stuff?
UPDATE: I found one tutorial on web (here) that demonstrates how to consume web services using Json-framework. Also, I found another one that demonstrates it using NSXMLParser (here). I'm not not very familiar with WSDL and SOAP, so any detailed explanation on how to implement would be desirable :). In both of these examples you just have to construct a request string in xml format and execute it, and that's it. Both examples actually bypasses the heavyness of SOAP and WSDL, so I was wondering do I have to know and do more that just construct a request string, execute it and get response?
While wsdl2objc is out there (as noted by #Girish Kolari), the truth is that there's no easy answer. I've never successfully gotten wsdl2objc working well for something that I couldn't have done more easily by hand. You will need to learn SOAP and WSDL. That's just a fact of life if you can't get access to a REST interface. In my experience, your best bet for simple SOAP access is to do it by hand, and your best bet for somewhat complicated SOAP access is gSOAP. Your best bet for very complicated access is to redesign something so it's not so complicated, ideally in REST. SOAP is a giant pain that some languages (C#) shield you from. ObjC does not shield you from it, so it continues to be a giant pain.
Yes, SOAP leaves a bad taste in my mouth.

Zend Framework XML-RPC?

I would like to build an XML over HTTP provisioning interface using Zend Framework. Should Zend_XmlRpc_Server be used for this purpose? If so, can you recommend any guides on using it? (Specifically the part retrieving incoming XML and parsing it.)
What kind of service is it? - will you send binary data or rather short texts? Will all clients be in PHP mostly or you are foreseeing a wide range of clients?
Usually if you're doing a web-based small service, REST will do the trick, it's easy to develop and consume, even by plain JS frontends, such as jQuery.
If it's something more complex, you can't go wrong with SOAP, though it's a bit complex in developing. Make sure you arm yourself with SoapUI
XmlRPC has some limitations, especially sending binary data. There's some thorough comparison to have a look at this blog

[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.
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.
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.
Google Buffers
If your looking for a language and platform agnostic solution have a look at Google Buffers. You can easily serialise objects for transmission over the wire.
This question should get you started in Objective-C.
JSON
I have also used JSON within iPhone Apps with great success. Again, relatively language and platform agnostic but much simpler than Google Buffers.
SOAP with Fast Infoset is suited for small devices:
JAX-WS 2.0 and its reference implementation support both Fast Infoset and MTOM/XOP. This article includes information about Web Service Performance for Fast Infoset vs. MTOM/XOP:
http://www.devx.com/xml/Article/35385/1954
Fast Infoset is optimized for small
devices that have bandwidth
constraints, and is supported by many
vendors such as Microsoft .NET and
.NET CF, Sun GlassFish, BEA WebLogic,
IBM SDK for Java 6.0 and others.
http://en.wikipedia.org/wiki/Fast_Infoset

iPhone application talking to a web service, the basics

We have an iPhone application created by an external consultancy that we're planning to add card payment facilities to in a subsequent release.
We plan to host a service ourselves in order to process the payment stuff, with SSL encryption. We have in-house expertese for all of this apart from the (contracted out) iPhone bit.
Are there any specific gotchas that we should be aware of that concern designing web services for iPhones?
We'll be writing the web service in C# 3.5.
JSON data format is better to be converted into NSArray or NSDictionary objects. It's easier and faster to be parsed.
So, specifically for the iPhone, it's a lot better to consume JSON data. Unless if there's some technical complexity that JSON is unable to handle.
Check YAJL:
http://github.com/lloyd/yajl
There are Objective-C wrapper/implementations by gabriel in github and by MGTwitterEngine.
TouchJSON is another code that's simpler than yajl. You can convert JSON string into NSDictionary or NSArray object in 2 lines of code. But, it maybe slower.
I'm not sure there are really any special considerations. The iPhone should be able to communicate with most types of webservice.
I worked on an iPhone app that communicated to a RESTful webservice written in Java.
I imagine it's pretty straightforward across the board - there are plenty of libraries for parsing/generating XML or JSON formatted messages, the iPhone can handle HTTP authentication, HTTPS, caching, etc.
It's just down to your iPhone developer to get it right :)
For SOAP based web services I strongly suggest that you try gSOAP. This library does not support Objective-C, however it supports C and C++ and is certainly the most complete open source project to access SOAP based web service; it also outperforms all of the other libraries.
For Objective-C you may want to try wsdl2objc, but I am not sure if it provides support for SSL/TLS (gSOAP does).
Finally, REST based web services are easily handled using ASIHTTPRequest.