Marco Strauch [
http://community.jboss.org/people/fambad] created the discussion
"Re: Force MTOM Response in JBossWS-3.1.1.GA"
To view the discussion, visit:
http://community.jboss.org/message/591635#591635
--------------------------------------------------------------
I have found a workaround for this problem by my own.
I have added a response handler to the webservice that add a dummy attachment part to the
soap message and activate mtom using the method
org.jboss.ws.extensions.xop.XOPContext#setMTOMEnabled(true) and declare the message as a
XOP Message. That's all.
*Code Sample:*
public boolean handleMessage( MessageContext msgContext ) {
....
... +// decide if outbound and other code left out+....
....
org.jboss.ws.core.soap.SOAPMessage msg = ((SOAPMessageContext)
msgContext).getMessage();
org.jboss.ws.core.CommonMessageContext cmCtx =
(org.jboss.ws.core.CommonMessageContext) msgContext;
ByteArrayDataSource DUMMY_PLAIN_DATA_SOURCE;
DUMMY_PLAIN_DATA_SOURCE = new ByteArrayDataSource(
"DUMMY_ATTACHMENT_TO_FORCE_MTOM_RESPONSE", "text/plain" );
*msg.addAttachmentPart( msg.createAttachmentPart( new DataHandler( DUMMY_PLAIN_DATA_SOURCE
) ) );*
*((SOAPMessageImpl) msg).setXOPMessage( true );*
Scope lastScope = cmCtx.getCurrentScope();
cmCtx.setCurrentScope( Scope.APPLICATION );
*XOPContext.setMTOMEnabled( true );*
cmCtx.setCurrentScope( lastScope );
...
}
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/591635#591635]
Start a new discussion in JBoss Web Services at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]