I am creating a WCF SOAP service which accepts MTOM messages. In general everything is working as expected, however it seems that my service only accepts attachments which are binary encoded. For example, if the attachment is sent like this (notice the Content-Transfer-Encoding
of 7bit
):
------=_Part_0_1053847062.1428586130682
Content-Type: text/xml; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-ID: <document.xml>
Content-Disposition: attachment; name="document.xml"
When this message is posted to my service I receive an error back:
<Message>Content-Transfer-Encoding '7bit' not supported for binary part. Must be 'binary'.</Message>
<StackTrace>at System.Xml.XmlMtomReader.CheckContentTransferEncodingOnBinaryPart(ContentTransferEncodingHeader header)
at System.Xml.XmlMtomReader.Read()
at System.Xml.XmlReader.ReadStartElement()
I had thought that there must be some binding setting which would allow the other Content-Transfer-Encoding
s but I can't seem to find anything. Does WCF only support a Content-Transfer-Encoding
of binary? If so, is there any way I can implement my own support for the others?
Another possible answer would be that in reality no other encodings are used besides binary and that is the only one that is needed. My original test was using SoapUI which seems to use non-binary encodings whenever possible, but this may not be an accurate test.