基于会话的Web服务 [英] Session Based Webservice

查看:88
本文介绍了基于会话的Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的Iphone应用程序调用基于会话的Web服务。但是,我无法让它工作,因为Iphone应用程序不允许使用存储会话信息所必需的cookie。

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 the 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

推荐答案

iPhone确实支持cookies 。您可以在上查看支持。 http://developer.apple.com/iphone/library/documentation/cocoa/reference/foundation/Classes/NSHTTPCookieStorage_Class/Reference/Reference.html

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

如果您只是在进行简单的HTTP请求,我强烈建议您使用来自ASIHTTPRequest的源代码 http:// allseeing-i .com / ASIHTTPRequest /

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

这篇关于基于会话的Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆