title: C# WCF - Creating custom Message content
body: <p>I have been inspecting messages sent in a WCF-based system, using the available IClientMessageInspector (and IDispatchMessageInspector).</p>
  
  <p>Currently I'm trying to manually add XML to the message, I cannot manage to get it working.</p>
  
  <p>Situation:
  Incoming message has a body like</p>
  
  <pre><code>&lt;s:Body&gt;
      &lt;Type xmlns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;
      ...
      &lt;/Type&gt;
  &lt;/s:Body&gt;
  </code></pre>
  
  <p>I want to replace the entire body with custom content, manually structured in a string. I.e., I have a correct XML body in a string, which I want to place within the body of the message.</p>
  
  <p>Is this even possible?</p>
  
  <p>Edit:
  To further clarify the question: Can I somehow access the "raw text" of the message, and edit it?</p>
  
  <p>Edit2: I.e. I want to keep the original header and all from the incoming message, but want to replace everything between </p>
  
  <pre><code>&lt;body&gt; &lt;/body&gt; 
  </code></pre>
  
  <p>with my custom content which currently resides in a string.</p>