我正在开发一个iOS iPad应用程序,用于连接Sharepoint。我使用ASIHTTPRequest框架来完成这个任务。我的代码如下:
NSURL *url = [NSURL URLWithString:@"https://SHAREPOINTURL"];
NSString *soapMessage = @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\n"
"<soap12:Body>\n"
"<GetListCollection xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\" />\n"
"</soap12:Body>\n"
"</soap12:Envelope>\n";
asiRequest = [ASIHTTPRequest requestWithURL:url];
[asiRequest setUsername:@"USERNAME"];
[asiRequest setPassword:@"PASSWORD"];
[asiRequest setDelegate:self];
[asiRequest appendPostData:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
[asiRequest addRequestHeader:@"Content-Type" value:@"text/xml; charset=utf-8"];
[asiRequest startAsynchronous];
到目前为止,一切都很好,但是当我调试时,出现了403禁止错误。为什么呢? 在我看来,我不认为用户名和密码有错。也许请求出了问题?