title: Consume Secure Web Service in MVC3
body: <p>I've consumed web services before (add reference > advanced > web reference). However, this one is proving difficult as I need to authenticate first.</p>
  
  <p>I have the address to my wsdl file that someone in our IS department made available. I need to authenticate with my network username/pass to use it, according to his instructions.</p>
  
  <p>So, using small words ;), can anyone help me understand how I might add this webservice to make calls?</p>
  
  <p>I am using VS 10 MVC3 (razor). The wsdl is accessed over http - https is not available.</p>
  
  <p>I appreciate all help!</p>
  
  <h2>Update</h2>
  
  <p>Based on @john-saunders post I took a local copy of the WSDL and referenced it (not as a web reference). I now see the  added to my web.config and it would seem to take username/password... but again, I'm new here. I really appreciate any help in pushing me over this (I hope) final hump!</p>
  
  <h2>Update #2</h2>
  
  <p>I've put in the following code. But intellisense doesn't show methods, I know there is search capability where I can pass one value (emplID) and get back other values (name, birth date). How do I call these/test my authentication?</p>
  
  <pre><code>using (var hrData = new CHMC_HRTECH_RES())
  {
      //CHMC_HRTECH_RES hrData = new CHMC_HRTECH_RES();
      CredentialCache cache = new CredentialCache();
      cache.Add(new Uri(hrData.Url),
      "Negotiate",
      new NetworkCredential("myuser", "mypass"));
      hrData.Credentials = cache;
  }
  </code></pre>