title: soapheader authentication
body: <p>I cannot get my client to reconise AuthHeaderValue which visual studio adds to proxy class
  I have seen many examples but could find nothing on how to resolve this.</p>
  
  <p>Soap class</p>
  
  <pre><code>     public class AuthHeader : SoapHeader
       {
          public string Username;
          public string Password;
  
       }
  </code></pre>
  
  <p>web service</p>
  
  <pre><code>     public class Service1 : System.Web.Services.WebService
       {
          public AuthHeader Authentication; ** where does visual studio append value to proxy 
  
      [SoapHeader("Authentication", Required = true)]
      [WebMethod]
      public string security()
      {
          if (Authentication.Username == "test" &amp;&amp;
              Authentication.Password == "test")
          {
              return "authenticated";
          }
          else
          {
              return "get lost";
          }            
      }
  </code></pre>
  
  <p>client</p>
  
  <pre><code>   static void Main(string[] args)
      {
          ServiceReference1.AuthHeader auth = new ServiceReference1.AuthHeader();
          auth.Username = "test";
          auth.Password = "test";
  
          ServiceReference1.Service1SoapClient ser = new ServiceReference1.Service1SoapClient();
          ser.AuthHeaderValue = auth;  ** does not reconise authheadervalue
          String message = ser.security();
          Console.WriteLine(message);
  
      }
  </code></pre>