title: Send xml data to the WCF REST service
body: <p>There is a self hosted WCF REST service, need to send an xml post message to it.
  Seems like this question was asked and answered several times, but after trying every solution I still didn`t get any success. </p>
  
  <p>Server: interface</p>
  
  <pre><code>[ServiceContract]
  public interface ISDMobileService
  {
      [OperationContract]
      [WebInvoke(Method = "POST", BodyStyle=WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat=WebMessageFormat.Xml)]
      int ProcessMessage(string inputXml);
  }
  </code></pre>
  
  <p>Server: class</p>
  
  <pre><code>public class Service : ISDMobileService
  {
      public int ProcessMessage(string inputXml)
      {
          Console.WriteLine( "ProcessMessage : " + inputXml );
          return 0;
       }  
  }
  </code></pre>
  
  <p>Server: hosting</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          WebServiceHost          host    =   new WebServiceHost(typeof(Service), new Uri("http://172.16.3.4:7310"));
          WebHttpBinding          webbind = new WebHttpBinding(WebHttpSecurityMode.None);
  
          ServiceEndpoint         ep      = host.AddServiceEndpoint(typeof(ISDMobileService), webbind, "");
          ServiceDebugBehavior    stp     =   host.Description.Behaviors.Find&lt;ServiceDebugBehavior&gt;();
          stp.HttpsHelpPageEnabled    =   false;
  
          host.Open();
          Console.WriteLine("Service is up and running. Press 'Enter' to quit &gt;&gt;&gt;");
          Console.ReadLine();
  
          host.Close();
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/9rSPc.jpg" alt="fiddler request"></p>
  
  <p>Request from fiddler without anything in the "Request Body" works just fine and fires break point inside ProcessMessage method of Service class, any variant of data in "Request Body", 
  e.g.: test || &lt;inputXml&gt;test&lt;/inputXml&gt; || inputXml="test" ||  &lt;?xml version="1.0" encoding="UTF-8" ?&gt;&lt;inputXml&gt;test&lt;/inputXml&gt; etc. gives HTTP/1.1 400 Bad Request</p>
  
  <p>Will appreciate any help with this</p>