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 asynchronous).
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.