title: How can I read SoapHeader in BeforeDeserialize in WebService
body: <p>How can I read SoapHeader in BeforeDeserialize, I try this, but it does not work. Any solution or simple example. Thank you.</p>
  
  <pre><code>    public class TicketIdentity
      {
          private string ticket;
  
          public string Ticket
          {
              get { return ticket; }
          }
  
          public TicketIdentity(string _ticket)
          {
              this.ticket = _ticket;
          }
      }
  
      public class TicketHeader : SoapHeader
      {
          public string Ticket;
          public TicketHeader(string ticket)
          {
              Ticket = ticket;
          }
          public TicketHeader()
          { }
      }
  
  ...
  
     string Key;
  
          public override void ProcessMessage(SoapMessage message)
          {
              switch (message.Stage)
              {
                  case SoapMessageStage.BeforeSerialize:
                      break;
                  case SoapMessageStage.AfterSerialize:
                      break;
                  case SoapMessageStage.BeforeDeserialize:
                      {
                       foreach (SoapHeader header in message.Headers)
                           {
                           if (header is TicketHeader)
                              {
                              TicketHeader tempHeader = (TicketHeader)header;
                              Key = tempHeader.Ticket;
                              }
                           }
                      }
                      break;
                  case SoapMessageStage.AfterDeserialize:
                      break;
                  default:
                      throw new ArgumentException("Chyba pri serializacii SOAP msg.");
              }
          }
  </code></pre>