atom feed6 messages in service retrieving MTOM message...
FromSent OnAttachments
Torben RiisJun 30, 2009 6:01 am 
Torben RiisJun 30, 2009 6:20 am 
Andreas VeithenJun 30, 2009 10:35 am 
Torben RiisJun 30, 2009 10:21 pm 
Andreas VeithenJul 1, 2009 12:57 pm 
Torben RiisJul 2, 2009 4:04 am 
Subject:Async service retrieving MTOM message -> Socket closed
From:Torben Riis (
Date:Jun 30, 2009 6:01:24 am


I'm struggling with an Axis2 client sending a MTOM message to an Axis2 service.
The service returns a socket closed exception. The client uses separate listeners (addressing) and sends a soap message
containing several MTOM attachments.

The client and service works perfectly if MTOM is disabled and uses the fallback
to Base64 encoded content or if just anonymous addressing is used instead (no

The service is configured with a "RawXMLINOutMessageReceiver" message receiver
and the parameter "messageReceiver.invokeOnSeparateThread" set to true.

During debugging I noticed that the problem only occurred when the service
returns with the HTTP status coded 202 before the business logic has called
getDataHandler() on OMText element. For my implementation the socket closed exception first happens for the second
or third attachment, but this can variate a lot. If I set a breakpoint in AbstractMessageReceiver#receive() where
AsyncMessageReceiverWorker is created as a new thread and ensures that the
business logic is invoked before AbstractMessageReceiver#receive() returns with
http status coded 202 everything works as designed. I noticed as well that
messageCtx.getEnvelope().build() in the same method detects that the message
context contains all 3 MTOM attachments correctly.

AbstractMessageReceiver#receive() ... if ((!WSDLUtil.isOutputPresentForMEP(mep)) || (replyTo != null && !replyTo.hasAnonymousAddress())) { AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker( messageCtx); messageCtx.getEnvelope().build(); messageCtx.getConfigurationContext().getThreadPool().execute( worker); return; }

And the funny part here is, that it seems to work on Jetty but not on Tomcat
5.5, Tomcat 6 or Websphere 6.1.

As I see it, the reason why the socket closed exceptions occurs, is due to that
some servers closes the connection when the service returns with status 202. But I'm not 100% sure.

Any help would be appreciated, a lot. :)

Regards Multi-Support R&D A/S