I solved this problem by creating a new class that comes from WebContentTypeMapper and changing the value of WebContentFormat to "Raw" when Content-Type = "text / xml". Along with this new class, I updated web.config to use the customBinding element in the "bindings" section.
public class XmlContentTypeMapper : WebContentTypeMapper { public override WebContentFormat GetMessageFormatForContentType(string contentType) { if (contentType.Contains("text/xml") || contentType.Contains("application/xml")) { return WebContentFormat.Raw; } else { return WebContentFormat.Default; } } }
web.config
<bindings> <customBinding> <binding name="XmlMapper"> <webMessageEncoding webContentTypeMapperType="Lt.Trigger.XmlContentTypeMapper, ExService" /> <httpTransport manualAddressing="true" /> </binding> </customBinding> </bindings>
source share