title: Call a WCF service with a HttpClient
body: <p>I have to call a WCF service. The WCF service is on and I can edit its configuration.</p>
  
  <p>I want to create a client that calls the service. I cannot add the service reference to my client, so I am trying to call it with a HttpClient.</p>
  
  <p>The client side code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    using (var client = new HttpClient())
      {
          //soapString is my input class serialized
          var content = new StringContent(soapString, Encoding.UTF8, "text/xml");
          using (var postResponse = client.PostAsync("http://localhost:52937/Attempts.svc/", content).Result)
          {
              string postResult = postResponse.Content.ReadAsStringAsync().Result;
  
          }
      }
  </code></pre>
  
  <p>The server side code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    [ServiceContract]
      public interface IAttempts
      {
          [OperationContract]
          void ReceiveAttemptResult(ReceiveAttemptResultInput result);
      }
  
      public class Attempts : IAttempts
      {
          string _backendUrl;
  
          public void ReceiveAttemptResult(ReceiveAttemptResultInput result)
          {
             //...
          }
      }
  </code></pre>
  
  <p>And in the end the web.config server side:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;system.serviceModel&gt;
        &lt;services&gt;
          &lt;service name="it.MC.Listeners.Attempts"&gt;
            &lt;endpoint address="" contract="it.MC.Listeners.IAttempts" binding="basicHttpBinding"/&gt;
            &lt;endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/&gt;
          &lt;/service&gt;
        &lt;/services&gt;
        &lt;behaviors&gt;
          &lt;serviceBehaviors&gt;
            &lt;behavior name=""&gt;
              &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /&gt;
              &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
            &lt;/behavior&gt;
          &lt;/serviceBehaviors&gt;
        &lt;/behaviors&gt;
        &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
      &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>When I call the service, I just obtain an empty string and I cannot stop in debug inside the service... What's wrong?</p>
  
  <p>Thank you</p>