Trc.entry(this, messageContext);
try {
// Determine if this is an async operation
boolean asyncMode =
messageContext.isPropertyTrue(WSIFJmsTransport.ASYNCOPERATION);
WSIFJMSDestination dest =
(WSIFJMSDestination) messageContext.getProperty(WSIFJmsTransport.DESTINATION);
Long transportSyncTimeoutValue =
(Long)messageContext.getProperty(WSIFJmsTransport.SYNC_TIMEOUT);
long syncTimeout =
transportSyncTimeoutValue==null
? SYNC_TIMEOUT
: transportSyncTimeoutValue.longValue();
Message message = messageContext.getRequestMessage();
// The next line has the desired side effect of setting
// up MIME attachements correctly. MIME attachments using
// AxisJms still don't work, because it falls over later.
message.getContentType(messageContext.getSOAPConstants());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
String contents = baos.toString();
if (asyncMode) {
performAsyncSend(messageContext, dest, contents);
} else {
String id = dest.send(contents, null);
String response = dest.receiveString(id, syncTimeout);
Message responseMessage = new Message(response);
messageContext.setResponseMessage(responseMessage);
}
} catch (IOException ioe) {
Trc.exception(ioe);