I'm using AFNetworking and find no way to get correct response, searched ways but closely able to get the below code but still getting error
Also i have another issue. Is there any way to find correct issue in web services? So far i am finding it very difficult to troubleshoot the mistake.
because server always return error code, i need some debugging tool which can able to tell like you have not placed header or incorrect content type, invalid format....
It just returns error code and that means a lot more....
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://www.somewebsiteurl/webservice/getResponse"]];
[request setHTTPMethod:@"POST"];
//set headers
NSString *contentType = [NSString stringWithFormat:@"text/html"];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];
//create the body
NSMutableData *postBody = [NSMutableData data];
[postBody appendData:[[NSString stringWithFormat:@"data={\"request\":{\"type\":\"getwork\"}}"] dataUsingEncoding:NSUTF8StringEncoding]];
//post
[request setHTTPBody:postBody];
//Response
{"response":{"message":"Invalid Request"}}
when i place this in http://apikitchen.com/ my webservice works