[jboss-user] [JBoss Web Services] - Re: Force MTOM Response in JBossWS-3.1.1.GA
Marco Strauch
do-not-reply at jboss.com
Mon Mar 7 08:51:30 EST 2011
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&containerType=14&container=2044]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110307/8b4164ee/attachment.html
More information about the jboss-user
mailing list