开发者

Session Based Webservice

开发者 https://www.devze.com 2023-01-04 20:08 出处:网络
I am trying to call a session based webservice from my Iphone application. However, I can\'t get it to work since an Iphone App doesn\'t allow having a cookie which is necessary for storing the sessio

I am trying to call a session based webservice from my Iphone application. However, I can't get it to work since an Iphone App doesn't allow having a cookie which is necessary for storing the session information.

I have read th开发者_开发知识库e following article and there seems to be a way to deal with session based webservices however, I can't find out how it should work.

http://msdn.microsoft.com/en-us/library/aa480509.aspx


The iPhone does support cookies. You can see the support at http://developer.apple.com/iphone/library/documentation/cocoa/reference/foundation/Classes/NSHTTPCookieStorage_Class/Reference/Reference.html

If you are just doing simple HTTP Requests, I highly recommend using the source code from ASIHTTPRequest http://allseeing-i.com/ASIHTTPRequest/

They make it REALLY easy to do simple requests for data and even handling the Async requests. I've been using the code in my application.

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消