Remove xml namespaces from WCF restful response
You can remove the XML namespace by setting the Namespace parameter of the DataContract attribute to an empty string, like so:
[DataContract(Namespace = "")]public class ResponseInfo{ // ...}
I hope this helps...
I had the same problem.Adding BodyStyle:=WebMessageBodyStyle.Bare to WebInvoke worked for me.Response is no longer wrapped in a metadata.
I assume you are trying instead of getting something like this at the beginning of your xml:
<ResponseInfo xmlns="http://schemas.datacontract.org/2004/07/ResponseInfo" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" >
You want just:
<ResponseInfo>
Sadly, I haven't seen an easy way yet to remove those fields. I was googling for solutions and most of the options for removing it require creating your own Message inspector, or your own encoder.