Iphone posting xml 400 error

Heather

New Member
I am trying to send a POST Request with XML Body,This is the code I am getting ,I am hitting the server but the server is not sending back any data , I am basically getting 400 as Response code.. Can any one tell me what I am doing wrong , Thanks in Advance \[code\]NSURL *resquest_URL = [NSURL URLWithString:@"http://165.***.**.**:****/SomeURL"]; NSMutableURLRequest *service_request =[NSMutableURLRequest requestWithURL:resquest_URL];NSString *xmlString =[NSString stringWithFormat:@"<Credential><UserName>*****</UserName><Password>******</Password><ApplicationType>****</ApplicationType><Product>*****</Product></Credential>"]; NSData *postData = http://stackoverflow.com/questions/13814087/[xmlString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; [service_request setHTTPMethod:@"POST"]; [service_request setHTTPBody:postData]; [service_request setValue:[NSString stringWithFormat:@"%d", [postData length]] forHTTPHeaderField:@"Content-Length"]; [service_request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];NSURLConnection *loing_connection = [[NSURLConnection alloc] initWithRequest:service_request delegate:self];\[/code\]
 
Back
Top