How to start use webservice - iphone

i want to read and write data to a website (server on web) and don't have any information about webservices and other things that related to it
Does anybody have any idea about how to start it (mean offer complete books,papers,tutorials,websites,… or what should i learn at first mean is it necessary to learn xml,soap,... and other things)
Thank you

I've used Google App Engine with great success. You would format your data to output as JSON and use an iPhone library to read it. I've used this one (though Touch JSON seems to be more popular).

Read about REST, ROA and AtomPub. Thats got me started. I'm about to implement some webservices in WCF (WCF now acts like a RESTFul webservice, but you can also use plain old SOAP). Before I got to WCF, I experimented with RoR. RoR uses REST "out-of-the-box".

Related

iPhone server-client application

I'm not sure this question is appropriate here but I hope I could get some help. What i'm looking to do is basically to make a server based iPhone application. I've got an ubuntu server ready to be used. I'm thinking of making a web service which my application then can use but I have virtually no experience in this field so i'm looking for some help to get pointed into the right direction, what language to write the web service in etc. It isn't required to be a web service but anything that make's the iPhone app depending on the server.
This little mission is simply for learning experience.
Probably PHP is what you will use to write the webservice. REST based services are the most popular, but it could be as simple as a form POST passing in parameters. The PHP script (no matter which way you write it), will then pass those parameters and any other needed info to a server method that either executes a SQL query (preferably using a stored procedure) or uses some other server resource. That data would then be output via the webservice as either XML or JSON (I personally like JSON better).
Check out Ray Wenderlich's tutorial on just this kind of thing:
When it comes time to handle the request in iOS, my personal choice is AFNetworking. It uses blocks instead of delegate methods and is blazing fast. I can hook you up with examples if needed.
Ok, First you need to learn how to write web services in PHP. Which will return you response in XML format. I personally prefer .PLIST format because it gets easier to parse on the iOS.
Once your web services are up and running. You need to use NSURLConnection and NSURLRequest to talk to your web services. Implementing the NSURLConnection Delegate methods correctly, you can download your XML response, maybe save it in a file on your Documents Directory.
Then once done downloading start parsing that response using NSXMLParser. implementing the delegates and what not, you can create your data structure the way you feel comfortable with manipulating it and store the parsed results in them and populate your View accordingly.

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.

iPhone app and server communication

We have a web-based BI reporting product. We have exposed certain webservices which mainly return html content and do authentication.
We are in a initial process of developing an iPhone App, which will interact with these services and get data on iPhone.
There are couple of things we need to make sure before we start with the actual development process...
1) Should we use SOAP or REST (Will have to write the server part in Java) for the communication between iPhone and our web-application?
2) If we use SOAP, Can you suggest something, which will effectively create web services stubs in Objective-C.
3) In either case (SOAP or REST), what security mechanism is suggested by Apple?
We want to know your thoughts on the best and effective way communication could be done between iPhone app and backend servers (mostly written in Java)
Thanks in advance.
If it is an option, I'd use REST
Never did it, but may this will help: http://abhicodehelp.blogspot.com/2010/12/handling-soap-with-iphone.html
I'd do any HTTP-Communication using ASIHttpRequest. It is SSL-capable
In my apps I use simple URL requests returning XML / Cocoa-touch plists over https. I guess that's called "REST" -- it's simple and quick to implement. There are long flame-fests over SOAP vs. REST -- I just use this technique and get my apps done :)

iPhone dealing with xml vs soap vs JSON vs RESTful

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

Which technique should I use to consume a .NET Web Service from the iPhone?

The description page for my .NET web Service includes 4 different protocols to use to consume it.
SOAP 1.1
SOAP 1.2
HTTP GET
HTTP POST
In my work-in-progress iPhone application I have used both SOAP 1.1 and HTTP GET to access the XML data and am then parsing to get the information I want.
I'm now refactoring the application and am creating a Data Library class that will use code-reuse to make my current data operations easier to maintain.
SOAP 1.1 seems straight forward enough, if a little unwieldy, are there any benefits for me to use SOAP 1.2 on the iPhone. I'm presuming the differences will have little consequence when all I'm doing is basic XML parsing for strings.
Also HTTP Get seems the easiest of the lot! A simple dataWithContentsOfURL appears sufficient to get what I need, I don't even need to do a post.
Are there any idiosyncrasies on the iPhone that make any of these techniques better than others?
I'm going to research a REST services now. I think I understand the concept of stateless but not sure how it applies to the 4 options above.
Thanks in advance!
dataWithContentsOfURL
Has always worked for me with no problems.