MTOM is not working

I know. This is an enticing title.
It’s just that I spent about 3 hours this afternoon to succeed in invoking a service with a Java client that had MTOM enabled.

It was not the first time that I did that. But this afternoon, I could not make it work. No way.
I knew my service was working because I had no trouble with SoapUI. But I also wanted to test with a Java client.
Generally, I like to test both kinds of service invocation (XML request directly or business objects).

I had generated a client with Apache CXF. The client had no dependency to CXF, it was a pure JAX-WS client.
I updated the binding to enable MTOM. But it did not work. The message my service was receiving did not contain a XOP element.
Instead, there was what I think to be the file’s content in a base64 encoding.

Eventually, the solution rose from both an intuition and the abyss of the Internet.
My project’s build path was using a JRE 6. And the JAX-WS support of the JRE does not handle MTOM attachments. At least, for the sending.
Switching to a JDK 6 ( solved the thing.

I would have appreciated an exception in the JRE implementation, saying “Not Implemented” when using setMtomEnabled( boolean ).
May this provocative title draw the attention of people that would have the same issue.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s