tags:

views:

51

answers:

1

How can i use Restful webservice in iphone instead of soap?

A: 

I also recommend searching for the possible answers to your question on Stackoverflow first. But one specific answer to using a REST base webservice. I highly recommend ASIHTTPRequest. They have a very easy method for retrieving data from a service. I have used the code in quite a few apps that needed to access webservices.

NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
    NSString *response = [request responseString];
}
christophercotton
is this method enough to receive data from service?what library files should i import to use ASIHTTPRequest?
carthee
Yes, the `response` variable will contain the data back from the service. Go to http://allseeing-i.com/ASIHTTPRequest/Setup-instructions and download their files and then copy them in following the instructions.
christophercotton