Hi Kristof,
MTOM optimization is applied right at the time when we write the message
on to the wire. This is done to avoid any bufferring. Having a handler
means that we transform the Message in to DOM or SOAPMessage. It results
in inlined base64 encoded data and it remains so when the data is
written over the wire. We we chose to write it out as attachment, it
will be more expensive than writing out directly.
This is done in order to avoid unnecessary conversion to and from when
there are handlers. So the bottom line is that when handlers are used
MTOM optimization does not happen.
Regarding performance getting worse with data larger than 3MB. It sounds
like a bug. There is already one reported which might be related to your
uses, see
https://jax-ws.dev.java.net/issues/show_bug.cgi?id=140.
thanks,
-vivek.
kristof.depraetere_at_agfa.com wrote:
>
> Hi,
>
> I use the SOAPHandler handler mechanism to add header information to
> the SOAP message by my web service client.
> However when MTOM is used to transfer large binaries (>3Mb) the
> performance penalty is huge (300 times slower). Using MIME with
> Attachments to transfer these binaries gives no performance impact in
> the same scenario.
>
> Apparently retrieving the SOAPPart from the messageContext is slow.
>
> I use the following to add a header to the envelope:
>
> public boolean handleMessage(SOAPMessageContext messageContext) {
> // ...
> SOAPEnvelope envelope =
> messageContext.getMessage().getSOAPPart().getEnvelope();
> SOAPHeader header = envelope.addHeader();
> //...
> }
>
> I'm using 2.1EA3.
>
> Any idea on how to speed this up?
>
> Thanks,
> Kristof