Reputation: 1500
Below is the code to request web service, I get the feed back @"List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user."
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];
The webservice is from sharepoint. I feel my code is correct. Can anyone give some advice? Thanks.
Upvotes: 0
Views: 222
Reputation: 1500
This should be SharePoint issue. Using IP directly will cause some issues. I solve the problem by mapping the host name.
Upvotes: 0
Reputation: 9481
offtopic:
ASIHTTPRequest is not longer supported and for POST Request the is a class ASIFormDataRequest
Please note that I am no longer working on this library - you may want to consider using something else for new projects. :)
You could you an alternative like:
Upvotes: 1