I want to remove the default xmlns (namespace) added to my service's response (see image below)
Is t开发者_如何学运维here a way to do this? This because in order to consume this service from a C# windows app, I have to add the namespace to every data object's header - DataContract that I will be serializing.
I think if you just use
[DataContract(Namespace="")]
on the Bookmarks
class, that should do it.
I just tried this and got the following:
<CompositeType xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<BoolValue>true</BoolValue>
<StringValue>Hello </StringValue>
</CompositeType>
Actually, WCF REST Contrib proved to be the perfect solution using their PoxDataContract.
Expanding on @Tawani's answer, if you want to support attributes or otherwise customize your XML serialization you can easily extend WcfRestContrib by creating a custom IWebFormatter
. Here's my answer to a similar question explaining how to do this using an XmlSerializer.
精彩评论