> On Mar 20, 2016, at 7:57 PM, Jason Pell <[email protected]> wrote: > I wanted to be able to turn MTOM on and off based on the content of the > operation in question. I wanted this to work as a CXF feature available on > either the client or server. What I have come up with is available here: > > https://github.com/pellcorp/JavaFirst/tree/cxf27/JavaFirst/src/main/java/com/pellcorp/cxf/mtom/ > > I used reflection to figure out if mtom applicable data types are in use. > For now in my code I always make sure to use a @XmlMimeType with the > DataHandler, so I use that logic in my code. > > What I am really after is whether any of you are aware of a better way, > presumeably by looking at the service model itself. Any initial guidance > for where I should start would be appreciated.
Well, I guess my first thought is anything that is byte[] can be output via MTOM. It’s not just stuff that has XmlMimeType. Thus, there are certainly cases that this will miss. Instead of using reflection, you could grab the XmlSchema type from the message/parts and scan through it looking for xsd:base64binary or xsd;hexBin. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
