title: Post xml using HttpClient in C#
body: <p>I have a problem with passing xml file from client to api. I use HttpClient to connect.
  My code:</p>
  
  <pre><code>ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) =&gt; true;
          /*var serializer = new XmlSerializer(typeof(InitUploadType));
          serializer.Serialize(data);*/
          XmlDocument doc = new XmlDocument();
          doc.Load("initupload-sign.xml");
  
          WebRequestHandler handler = new WebRequestHandler();
          X509Certificate2 certificate = new X509Certificate2("cert.crt");
          handler.ClientCertificates.Add(certificate);
  
  
          HttpClient client = new HttpClient(handler);
          client.BaseAddress = new Uri("https://test-e-dokumenty.mf.gov.pl");
          client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xml"));
  
          var response = client.PostAsJsonAsync&lt;XmlDocument&gt;("/api/Storage/InitUploadSigned", doc).Result;
  
          return response.ToString();
  </code></pre>
  
  <p>I am receiving Bad Request 400.</p>