I have a form in my iPhone application which contains three textFields and a post-button, of course.
I have built two WebMethods 开发者_StackOverflow中文版in a WebService, I have tried both from my local PC. They works perfectly. The methods are:
- TestAddData - no parameters
- AddObject(string name, string address, string phoneNumber)
I know wonder how to call this web services from my iPhone application. The current code:
NSURL *url = [[NSURL alloc] initWithString:@"http://www.domain.com/Service.asmx"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request startSynchronous];
// Parameters:
//[request setPostValue:@"value" forKey:@"parameterInMethod"];
//[request setPostValue:@"value" forKey:@"parameterInMethod"];
Edit: I figured out how to select which method to call. The code for that was:
[request setRequestMethod:@"TestAddData"];
But it returns 403 - Forbidden. The Service.asmx-file is read and write.
Both my WebMethods is public. TestAddData is "public string", and AddObject is "public void".
HI,Sorry my friend i didn't got your problem actually. But * 403.1 - Execute access forbidden. * 403.2 - Read access forbidden. * 403.3 - Write access forbidden. * 403.4 - SSL required. * 403.5 - SSL 128 required. * 403.6 - IP address rejected. * 403.7 - Client certificate required. * 403.8 - Site access denied. * 403.9 - Too many users. * 403.10 - Invalid configuration. * 403.11 - Password change. * 403.12 - Mapper denied access. * 403.13 - Client certificate revoked. * 403.14 - Directory listing denied. * 403.15 - Client Access Licenses exceeded. * 403.16 - Client certificate is untrusted or invalid. * 403.17 - Client certificate has expired or is not yet valid. it may work for you.Check which type of error occur.
精彩评论