I have a WCF service hosted and I\'m trying to use it within an iPhone app as a JSON POST request. I plan on using the JSON serializer later, but this is what I have for the
dic is NSMutable Dictionary with object and keys. baseUrl is your server webservice url.
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic
options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSString *encodedString = [jsonString base64EncodedString];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@wsName",baseUrl]];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setValue:encodedString forHTTPHeaderField:@"Data"];