title: Calling a Web API From a .NET Client (C#)
body: <p>I am trying to read a response XML from a service to a class to use it.
  if i use this URL <code>https://btsvcs.college.edu/HR/Employee/ID/NAGWA_N@COLLEGE.EDU</code></p>
  
  <p>The response XML will be like this:</p>
  
  <pre><code>&lt;Data&gt;
    &lt;Record id="PA01051" rowOrder="0"&gt;
      &lt;employee_id&gt;20000343&lt;/employee_id&gt;
    &lt;/Record&gt;
  &lt;/Data&gt;
  </code></pre>
  
  <p>I had create my class to be the same with the response XML.</p>
  
  <p>This is the class:</p>
  
  <pre><code>public class GetEmployeeIdByEmail
  {
      [DataContract(Namespace = "")]
      public class Record
      {
  
          [DataMember(Order = 0)]
          public string employee_id { get; set; }
      }
  
      [DataContract(Namespace = "")]
      public class Data
      {
          [DataMember(Order = 0)]
          public Record Record { get; set; }
      }
  }
  </code></pre>
  
  <p>After that i had make a function to read the XML using  the <code>HttpClient</code> </p>
  
  <p>This is the function:</p>
  
  <pre><code>public async Task&lt;GetEmployeeIdByEmail&gt; GetEmployeeIdByEmail()
  {
      var client = new HttpClient();
      var url = "https://btsvcs.college.edu/HR/Employee/ID/NAGWA_N@COLLEGE.EDU";
      client.BaseAddress = new Uri(url);
      client.DefaultRequestHeaders.Accept.Clear();
  
      client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xml"));
      var responseMessage = await client.GetAsync(url);
      GetEmployeeIdByEmail responseData = null;
  
      if (responseMessage.IsSuccessStatusCode)
      {
          responseData = await responseMessage.Content.ReadAsAsync&lt;GetEmployeeIdByEmail&gt;();
      }
  
      return responseData;
  }
  </code></pre>
  
  <p>If I make a break point on this function and tracking it step by step always get back to website to read the xml after this line</p>
  
  <p><code>var responseMessage = await client.GetAsync(url);</code> and no response back to complete the debugging.</p>
  
  <p>I don't know what is reason for that.</p>