title: WCF client does not include XML declaration in HTTP POST message
body: <p>This post regards the last hurdle in completing my task of communicating with a Cisco router via the Web Services Management Agent (WSMA), as described <a href="https://stackoverflow.com/questions/3658385/working-with-cisco-wsma-from-net">here</a> and <a href="https://stackoverflow.com/questions/3676246/working-with-cisco-wsma-from-net-part-two">here</a>. You will not have to read those posts to understand my current question, though.</p>
  
  <p>The problem is this: I have build service and message contracts to match the router's web services, and configured a basicHttpBinding and an endpoint. And using a channel factory, I am now almost, but not quite, communicating successfully with the router.</p>
  
  <p>I keep getting a SOAP fault in return, stating that "An expected XML tag or sequence is missing". Using WCF tracing, fiddler and debugging on the router, and manually posting messages over HTTP, I have finally figured out what's going on.</p>
  
  <p><em>The WSMA agent on the router expects the SOAP message payload in the HTTP request to include an XML declaration. And WCF isn't sending one.</em> As simple as that.</p>
  
  <p>So my question is: <strong>How can I make WCF, using a basicHttpBinding, include an XML declaration in the message?</strong></p>
  
  <p>For reference, my binding configuration looks like this:</p>
  
  <pre><code>&lt;basicHttpBinding&gt;
    &lt;binding name="BasicHttpBinding_IWsmaService" messageEncoding="Text" textEncoding="UTF-8" allowCookies="false"&gt;
      &lt;security mode="TransportCredentialOnly"&gt;
        &lt;transport clientCredentialType="Basic" proxyCredentialType="None" realm="level_15" /&gt;
      &lt;/security&gt;
    &lt;/binding&gt;
  &lt;/basicHttpBinding&gt;
  </code></pre>
  
  <p>(in case you wonder - yes, I am aware that I'm sending clear-text credentials over an unencrypted transport)</p>