Trying to get MTOM working in a WCF client. The particular function I\'m trying to consume sends an MTOM-encoded byte array of a PDF document. Using SoapUI to test the API u
UPDATE: As @Tone mentions in the comments, the original accepted answer below is wrong. It is actually valid (and required) for the outer Content-Type of an MTOM HTTP response header to have the value "multipart/related". This is the header the original poster received:
Content-Type multipart/related; boundary="MIMEBoundaryurn_uuid_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"; start-info="text/xml"; type="text/xml"; start="<0.urn:uuid:xxxxxxxxxxxxxxxxxxxxxxxxxxxx@apache.org>"
The real problem seems that the "type" attribute is "text/xml" and not "application/xop+xml".
==============================================
Original answer:
The Content-Type header here is "multipart/related". This is not the right header to send for MTOM response, so I believe this is as server error. As the exception mentions, "MTOM messages must have (content) type 'application/xop+xml'". Try to hard code it on the server, or temporaly change it in some proxy to see that wcf will work (you could also try a wcf custom message encoder, should override one property - ContentType - to return right type). Note there are binary payload (file attachment) standards that allow content type of "multipart/related" but wcf does not support them. However here the message payload uses the tag so I beleive the server does mean to send mtom but does not use the right content-type header.
BTW here is an implementaion for the other attachment standard I mentioned for wcf. it may work for you, the pdf will be available in some property. but on the other hand since the xml uses it might not be valid so you might need to tweak it in an encoder anyway. so the best is to solve the root problem in the server.
For my case, I was getting the indicated error, in my binding I had
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
it did not start working until I added:
maxBufferSize="2147483647"
Just incase anyone has the same issue.