WCF MTOM - Support Non-Binary Formats
Asked Answered
P

0

6

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-Encodings 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.

Paterfamilias answered 9/4, 2015 at 13:46 Comment(1)
I'm having a similar issue, but from the other end: #35041368Slaphappy

© 2022 - 2024 — McMap. All rights reserved.