title: How can I support XML with or without namespace, with my WCF HTTP REST service
body: <p>I have a series of objects that look like this:</p>
  
  <pre><code>namespace MyNamespace
  {
    [DataContract(Namespace="")]
    public class MyClass1
    {
      [DataMember]
      public string MyProperty {get;set;}
    }
  }
  </code></pre>
  
  <p>I have a method which exposes the WebInvoke that looks like this (very simplified as this actually does nothing right now, but still works for this test)</p>
  
  <pre><code>[WebInvoke(UriTemplate = "", Method="POST")]
  public MyNamespace.MyClass1 GetItem(MyClass1 postedItem) { return postedItem; }
  </code></pre>
  
  <p>I would really like to be able to accept XML that looks like this:</p>
  
  <pre><code>&lt;MyClass1&gt;
    &lt;MyProperty&gt;1&lt;/MyProperty&gt;
  &lt;/MyClass1&gt;
  </code></pre>
  
  <p>or this:</p>
  
  <pre><code>&lt;MyClass1 xmlns:"http://schemas.datacontract.org/2004/07/MyNamespace"&gt;
    &lt;MyProperty&gt;1&lt;/MyProperty&gt;
  &lt;/MyClass1&gt;
  </code></pre>
  
  <p>But so far my research seems to indicate this is not possible.  My only idea right now is to use a IDispatchMessageInspector and consume the message, remove the xmlns namespace, and then allow WCF to continue processing the message.  I have not had a lot of luck with this however, because once I consume the message it is no longer available for WCF to consume and deserialize.</p>
  
  <p>Is there an easier way?  Is there a better way?</p>