0

下面是请求网络服务的代码,我收到反馈@“列表不存在。您选择的页面包含不存在的列表。它可能已被其他用户删除。”

NSString *soapMessage = @"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><GetList xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"><listName>Contact</listName></GetList></soap:Body></soap:Envelope>";

NSString * wsURL = @"http://192.168.11.133/Jason/_vti_bin/Lists.asmx";

NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",wsURL]];
ASIHTTPRequest * theRequest = [ASIHTTPRequest requestWithURL:url];

[theRequest addRequestHeader:@"Content-Type" value:@"text/xml; charset=utf-8"];
[theRequest addRequestHeader:@"SOAPAction" value:@"http://schemas.microsoft.com/sharepoint/soap/GetList"];
[theRequest setUsername:@"username"];
[theRequest setPassword:@"password"];
 [theRequest addRequestHeader:@"Content-Length" value:msgLength];
 [theRequest setRequestMethod:@"POST"];
 [theRequest appendPostData:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

 [theRequest setDefaultResponseEncoding:NSUTF8StringEncoding];

[theRequest setTimeOutSeconds:20];
[theRequest setDidFailSelector:@selector(onRequestFail:)];
[theRequest startSynchronous];

该网络服务来自共享点。我觉得我的代码是正确的。谁能给点建议?谢谢。

4

2 回答 2

1

无关:

ASIHTTPRequest不再受支持,对于 POST 请求,它是一个类ASIFormDataRequest

请注意,我不再在这个库上工作——你可能想考虑为新项目使用其他东西。:)

您可以选择一个替代方案,例如:

于 2012-10-19T09:16:00.360 回答
0

这应该是 SharePoint 问题。直接使用IP会导致一些问题。我通过映射主机名解决了这个问题。

于 2012-10-23T09:56:29.273 回答