i am posting the parameter in the web-service. using the below code. and i am getting the "Request failed: unacceptable (406) Error .I am not sure is im posting it right .
I tried posting the data using their key and value pair using POSTMAN chrome app . and it is working fine there.Not here pls suggest .i am using Afnetworking for the first time
[params setValue:self.txtUserName forKey:@"name"];
[params setValue:self.txtEmail forKey:@"mail"];
[params setValue:self.txtPass forKey:@"conf_mail"];
[params setValue:self.txtPass2 forKey:@"pass"];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:@"http://charlie.indivar.info/ministore/store-commerce/user/register"
parameters:params
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error Retrieving Data"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
}];
Below is the console log
Error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unacceptable (406)" UserInfo=0x8deb400 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x8ddddf0> { URL: http://website.com/ministore/store-commerce/user/register } { status code: 406, headers {
"Cache-Control" = "no-cache, must-revalidate, post-check=0, pre-check=0";
Connection = "Keep-Alive";
"Content-Length" = 396;
"Content-Type" = "application/json";
Date = "Fri, 10 Oct 2014 07:06:40 GMT";
Etag = "\"1412924800\"";
Expires = "Sun, 19 Nov 1978 05:00:00 GMT";
"Keep-Alive" = "timeout=5, max=100";
"Last-Modified" = "Fri, 10 Oct 2014 07:06:40 +0000";
Server = Apache;
"Set-Cookie" = "SESSd5cd87b70f9ea9019d306d6f4e440b74=5lpY8-PvQYRM5IBWiGk33EeXsucAJCBZQSce7vRBhEY; expires=Sun, 02-Nov-2014 10:40:01 GMT; path=/; domain=website.com; HttpOnly";
Vary = Accept;
"X-Drupal-Cache" = MISS;
"X-Powered-By" = "PHP/5.3.10-1ubuntu3.14";
} }, NSErrorFailingURLKey=http://website.com/ministore/store-commerce/user/register, NSLocalizedDescription=Request failed: unacceptable (406), com.alamofire.serialization.response.error.data=
0a7b2273 74617475 73223a22 30222c22 64617461 223a7b22 6e616d65 223a2255 7365726e 616d6520 63616e6e 6f742062 65206c6f 6e676572 20746861 6e203630 20636861 72616374 65727320 62757420 69732063 75727265 6e746c79 20323031 20636861 72616374 65727320 6c6f6e67 2e222c22 6d61696c 223a2254 68652065 2d6d6169 6c206164 64726573 7320266c 743b5549 54657874 4669656c 643a2030 78386462 63306230 3b206672 616d6520 3d202835 37203135 343b2031 35332033 30293b20 74657874 203d2026 23303339 3b646565 70616b73 6f6f6440 64656570 616b2e63 6f6d2623 3033393b 3b20636c 69707354 6f426f75 6e647320 3d205945 533b206f 70617175 65203d20 4e4f3b20 6175746f 72657369 7a65203d 20524d2b 424d3b20 67657374 75726552 65636f67 6e697a65 7273203d 20266c74 3b4e5341 72726179 3a203078 38663665 38613026 67743b3b 206c6179 6572203d 20266c74 3b43414c 61796572 3a203078 38646165 65653026 67743b26 67743b20 6973206e 6f742076 616c6964 2e227d7d>}