title: SOAP Request with HttpClient
body: <p>I'am trying to reach a SOAP API using the HttpClient object. I've searched everywhere but most of the people are using the HttpWebRequest object which is not supported by the DNX Core framework.</p>
  
  <p>Does anyone have a working example of a SOAP request using the HttpClient object?</p>
  
  <p>This image represents a simple request from this API (NuSOAP PHP):</p>
  
  <p><a href="https://i.stack.imgur.com/l2dmE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l2dmE.png" alt="enter image description here"></a></p>
  
  <p>Thank you!</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>So I was able to call the API with the following code:</p>
  
  <pre><code>        Uri uri = new Uri("http://localhost/teek_api/service.php");
  
          HttpClient hc = new HttpClient();
  
          hc.DefaultRequestHeaders.Add("SOAPAction", "http://localhost/teek_api/service.php/ping");
          var content = new StringContent("text/xml; charset=utf-8");
  
          using (HttpResponseMessage response = await hc.PostAsync(uri, content))
          {
              var soapResponse = await response.Content.ReadAsStringAsync();
              string value = await response.Content.ReadAsStringAsync();
  
  
              return value;
          }
  </code></pre>