title: Add Soap Header to Soap request in Visual Studio 2008
body: <p>I'm trying to use a third party web service (so I do not have access to the web service code).
  In Visual Studio 2008 I created a new web site project (ASP and c#), and added the web reference (not web service! so I guess it is not a WCF service... correct?).</p>
  
  <p>The problem is that from the documentation of the web service I know that each soap request has to be sent with the following envelope and header, can you please tell me how to add this in my Soap requests?
  All the solutions I found required modifying the web service source or proxy, I can't do that because I don't have access to the web service source and the web service proxy in the client in Visual studio 2008 comes in a read-only temp file!</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
  &lt;soap:Header&gt;
  &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" soap:mustUnderstand="1"&gt;
  &lt;wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
  &lt;wsse:Username&gt;gimme.data@stats.com&lt;/wsse:Username&gt;
  &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"&gt;Ima5tatto&lt;/wsse:Password&gt;
  &lt;/wsse:UsernameToken&gt;
  &lt;/wsse:Security&gt;
  &lt;/soap:Header&gt;
  &lt;soap:Body xmlns:ns2="http://neighbourhood.statistics.gov.uk/nde/v1-0/discoverystructs"&gt;
  &lt;ns2:AreaAtLevelElement&gt;
  &lt;AreaIdWithLevelType&gt;
  &lt;AreaId&gt;276704&lt;/AreaId&gt;
  &lt;LevelTypeId&gt;12&lt;/LevelTypeId&gt;
  &lt;/AreaIdWithLevelType&gt;
  &lt;/ns2:AreaAtLevelElement&gt;
  &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>