title: How to send xml via post with wcf
body: <p>How can I send xml data via post with help of WCF ? </p>
  
  <p>for example I have some code:</p>
  
  <pre><code>public interface IServiceForILobby
  {
      [OperationContract]
      [WebInvoke(Method = "POST")] 
      string SendXml(string response);
  }
  </code></pre>
  
  <p>//This is HOST</p>
  
  <pre><code>static void Main(string[] args)
  {
      Console.WriteLine("*Console Based Rest HOST*");
  
      using (WebServiceHost serviceHost = new WebServiceHost(typeof(ServiceForILobby)))
      {
          serviceHost.Open();
          Console.ReadLine();                
      }
  </code></pre>
  
  <p>/*This is Client */</p>
  
  <pre><code>using (ChannelFactory&lt;IServiceForILobby&gt; cf = new   ChannelFactory&lt;IServiceForILobby&gt;(new WebHttpBinding(), "http://192.168.1.103:50000/RestService/SendXml?response={x}"))
  {
      cf.Endpoint.EndpointBehaviors.Add(new WebHttpBehavior());
      IServiceForILobby channel = cf.CreateChannel();
      string s;
      // s = channel.SendXml("http://192.168.1.103:50000/RestService/SendXml?response={x}");
      string a;
  
      using (StreamReader sr = new StreamReader("simplexml.txt"))
      {
          string xmlCode = sr.ReadToEnd();
          s = channel.SendXml(xmlCode);
      }
  </code></pre>
  
  <p>I want to send XML from the Client to the Host, and after to parse it like this <a href="https://stackoverflow.com/questions/55828/how-does-one-parse-xml-files">How does one parse XML files?</a></p>