title: Ws-Security 1.1 Header Security not understood
body: <p>I am trying to write a client to call a web service that uses WS-Security 1.1
  . They provided a WSDL and I generated the code through Visual Studio.</p>
  
  <p><strong>(UPDATE)</strong> Here is the binding</p>
  
  <pre><code>&lt;basicHttpBinding&gt;
      &lt;binding name="BasicHttpBinding_IConnectService"&gt;
        &lt;security mode="TransportWithMessageCredential" /&gt;
      &lt;/binding&gt;
  &lt;/basicHttpBinding&gt;
  </code></pre>
  
  <p>Here is my request</p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;s:Header&gt;
       ...
          &lt;Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
              &lt;u:Timestamp u:Id="7c10648f-984d-4920-849e-b0afb586f871"&gt;
                  &lt;u:Created&gt;2016-08-24T13:08:06.118Z&lt;/u:Created&gt;
                  &lt;u:Expires&gt;2016-08-24T14:08:06.118Z&lt;/u:Expires&gt;
              &lt;/u:Timestamp&gt;
              &lt;o:UsernameToken&gt;
                  &lt;o:Username&gt;actualUsername&lt;/o:Username&gt;
                  &lt;o:Password&gt;realPassword&lt;/o:Password&gt;
              &lt;/o:UsernameToken&gt;
          &lt;/Security&gt;
      &lt;/s:Header&gt;
      &lt;s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  </code></pre>
  
  <p>Through Fiddler, I can see that the data I want is getting returned. </p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
      &lt;s:Header&gt;
          &lt;o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
              &lt;u:Timestamp u:Id="_0"&gt;
                  &lt;u:Created&gt;2014-05-02T14:02:46.988Z&lt;/u:Created&gt;
                  &lt;u:Expires&gt;2014-05-02T14:07:46.988Z&lt;/u:Expires&gt;
              &lt;/u:Timestamp&gt;
          &lt;/o:Security&gt;
      &lt;/s:Header&gt;
      &lt;s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      ....
      The data I really want
  </code></pre>
  
  <p>However, in Visual Studio I get this error:</p>
  
  <blockquote>
    <p>The header 'Security' from the namespace '<a href="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" rel="nofollow">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</a>' was not understood by the recipient of this message, causing the message to not be processed.  This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process.  Please ensure that the configuration of the client's binding is consistent with the service's binding.</p>
  </blockquote>
  
  <p>How do I correct this error? Given that I see the data coming back, it seems like a configuration problem.</p>