views:

4045

answers:

6

Questions on calling web services from iPhone?

  1. Anyone have any recommended tutorials on doing this?
  2. Anyone have any best practices on implementing security with these calls?
  3. Has anyone made or seen any shared libraries or wrappers for easy web service calls from the iPhone?
A: 

Are you calling your own web service, or an existing one? The Facebook Connect API for the iPhone is a great example of a library to do API calls from the iPhone.

Dan Lorenc
+3  A: 

This is much simpler to do than on most mobile devices - and more robust (in my opinion).

Best practices - use operations (NSOperation) to handle the requests - this is the best way I have found to reduce the complexities of threading with web calls and take everything off the main thread.

For security make HTTPS calls.

You might want to consider using JSON for the call - then this library is useful : http://code.google.com/p/json-framework/

However you should find it very easy to make web requests with the normal iPhone commands.

Ah yes a tutorial: SeismicXML or go and check out the Stanford lectures for CS193P - lecture 9 should be your cup of tea!

http://www.stanford.edu/class/cs193p/cgi-bin/index.php

Grouchal
+1  A: 

I have had good luck using NSURLConnection in async mode with Digest authentication and GET/POST.

I have heard good things about ASIHTTPRequest for file upload and more complex tasks: http://allseeing-i.com/ASIHTTPRequest-CFNetwork-wrapper-for-HTTP-requests You don't want to use CFNetwork directly if you don't have to.

Apple's got a huge collection of security practice info: http://developer.apple.com/security/

sehugg
A: 

HTTPS isn't a full answer on 'security' -- handles encryption, but what about authentication & authorization?

I'd love to find someone has a working RESTful client that does authentication with an LDAP/AD enabled enterprise application server; as an alternative to the heavy SOAP/ws-security model....

Neil
+1  A: 

http://sudzc.com/

it will generate Obj c soap client. here u can get example and documentation of your webservice if u giving your wsdl url

Sijo