下面是请求网络服务的代码,我收到反馈@“列表不存在。您选择的页面包含不存在的列表。它可能已被其他用户删除。”
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];
该网络服务来自共享点。我觉得我的代码是正确的。谁能给点建议?谢谢。