I solved this issue by creating a new class that derives from WebContentTypeMapper and changing the WebContentFormat to 'Raw' when the Content-Type = 'text/xml'. Along with this new class, I updated the web.config to use the 'customBinding' element under 'bindings'.
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>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…