Username and password can be posted in the web service url itself to authenticate.
Suppose you have following information:
Webservice url: http://sitename.com
then you can add your credential in web service url and new url will be:
In iphone, you can do this using string manipulation.
NSString *upd = [NSString stringWithFormat:@"%@%@%@%@%@", @"://" , userName, @":",password, @"@"]; upd = [urlString stringByReplacingOccurrencesOfString:@"://" withString:upd] ; newUrlString =(NSMutableString *) upd;The logic is to replace "://" to "://myusername:mypassword@" in the web service url. Now you can use this new url to NSMutableURLRequest object to call web service.
Hope, It helps.