title: Sending request iOS, responce status code: 500
body: <p>Hello I'm sending json data to odata server, but I get status code 500 in responce. Hence 500 is described as a server failure I was assured that server works fine. I googled a lot and I still cant figure out what is wrong... Here is my code:</p>
  
  <pre><code>NSMutableURLRequest *request2 = [NSMutableURLRequest requestWithURL:url];
       //I found thet some people had troubles due to their url had some spetial characters inside, however this is not my case
  
       //Create POST Params and add it to HTTPBody
       [request2 setHTTPMethod:@"POST"];
       [request2 setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
       [request2 setValue:@"application/json" forHTTPHeaderField:@"Accept"];
       [request2 setHTTPBody:jsonData];
  
       //authorization
       NSString *authStr2 = @"username:password";
       NSData *authData2 = [authStr2 dataUsingEncoding:NSUTF8StringEncoding];
       NSString *authValue2 = [NSString stringWithFormat: @"Basic %@",[authData2 base64EncodedStringWithOptions:0]];
       [request2 setValue:authValue2 forHTTPHeaderField:@"Authorization"];
  
       //Create task
       NSURLSessionDataTask *dataTask = [defaultSession dataTaskWithRequest:request2 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
       NSLog(@"Response:%@ %@\n", response, error);
       if(error){
       NSLog(@"ERROR---0");
       }
       }];[dataTask resume];
  </code></pre>
  
  <p>Im glad for any idea where I could mess up, thanks very much!</p>