WCF REST: is it possible to remove the namespace added to my XML response?

I want to remove the default xmlns (namespace) added to my service response (see image below) alt text

Is there any way to do this? This is because in order to use this service from a C # windows application, I need to add a namespace to each header of the data object - DataContract, which I will serialize.

+3
source share
3 answers

In fact, WCF REST Contrib turned out to be the perfect solution using PoxDataContract .

+1
source

I think if you just use

[DataContract(Namespace="")]

Bookmarks, .


:

<CompositeType xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <BoolValue>true</BoolValue>
  <StringValue>Hello </StringValue>
</CompositeType>
+6

By expanding on the @Tawani answer , if you want to support attributes or otherwise customize XML serialization, you can easily extend WcfRestContrib by creating a custom one IWebFormatter. Here is my answer to a similar question explaining how to do this with XmlSerializer.

0
source

Source: https://habr.com/ru/post/1738716/


All Articles