我正在开发一个 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 FORBIDDEN 错误。为什么?在我看来,我不认为错误是用户名和密码。也许请求有问题?