NSURL *url = [NSURL URLWithString:@"http://www.yourURL.com"];
//NSString *jsonRequest = [NSString stringWithFormat:@"&json_data=%@",[[NSString stringWithFormat:@"{\"createInvoice\":{\"client_id\":\"%@\",\"address\":\"\",\"invoice_title\":\"%@\",\"number\":\"\",\"date\":\"%@\",\"due_date\":\"%@\",\"late_fee\":\"\",\"schedule_date\":\"%@\",\"po_number\":\"\",\"status\":\"paid\",\"notes\":\"invoice notes\",\"terms\":\"invoice terms\",\"items\":[{\"name\":\"Test4\",\"type\":\"Product\",\"description\":\"\",\"unit_cost\":\"15\",\"quantity\":\"100\",\"discount\":\"10\",\"discount_type\":\"Percent\",\"tax1_name\":\"\",\"tax1_type\":\"\",\"tax2_name\":\"\",\"tax2_type\":\"\",\"tax1_percent\":\"\",\"tax2_percent\":\"\"}]}}",selected_Client_ID,invoiceTitleTxtFld.text,invoiveDateTxtFld.text,invoiceDueDateTxtFld.text,scheduleOnTxtFld.text] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *jsonRequest = [NSString stringWithFormat:@"&json_data=%@",[[NSString stringWithFormat:@"{\"updateInvoice\":{\"invoice_id\":\"%@\",\"client_id\":\"60105\",\"address\":\"ABS\",\"invoice_title\": \"%@\",\"number\":\"inv-7774 new\",\"date\":\"2012-03-30\",\"due_date\":\"2012-04-30\",\"late_fee\":\"\",\"schedule_date\":\"2012-03-31\",\"po_number\":\"PO-7770\",\"status\":\"paid\",\"notes\":\"invoice notes\",\"terms\":\"invoice terms\",\"items\":[{\"name\":\"Test4\",\"type\":\"Product\",\"description\":\"Test4 desc\",\"unit_cost\":\"15\",\"quantity\":\"100\",\"discount\":\"10\",\"discount_type\":\"Percent\",\"tax1_name\":\"\",\"tax1_type\":\"\",\"tax2_name\":\"\",\"tax2_type\":\"\",\"tax1_percent\":\"\",\"tax2_percent\":\"\"}]}}",delegate.invoice_ID,invoiceTitleTxtFld.text] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *json_data = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setHTTPMethod:@"POST"];
[request setHTTPBody: json_data];
NSLog(@"%@",json_data);
//[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
//[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [json_data length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:[[jsonRequest stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]
dataUsingEncoding:NSUTF8StringEncoding
allowLossyConversion:YES]];
// [NSURLConnection connectionWithRequest:[request autorelease] delegate:self];
NSUrlsConnection *conn_InvEdit = [[NSURLConnection alloc] initWithRequest:request delegate:self];
// Successful connection.
if (conn_InvEdit) {
// [self initSpinner];
// [self spinBegin];
NSMutableData *data = [[NSMutableData alloc] init];
self.receivedData=data;
[data release];
}
// Unsuccessful connection.
else {
}
// Clean up
[url release];
[request release];
// Close keypad.
Try with this code, If you still have any problem then send me your complete question at akram.khan@mail.vinove.com. I'll send you sample app with solution.