// for JMS but just get the payload in its native format
String jmsPayloadType = guessMessageType(msgContext);
if (jmsPayloadType == null) {
OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext);
MessageFormatter messageFormatter = null;
try {
messageFormatter = TransportUtils.getMessageFormatter(msgContext);
} catch (AxisFault axisFault) {
throw new JMSException("Unable to get the message formatter to use");
}
String contentType = messageFormatter.getContentType(
msgContext, format, msgContext.getSoapAction());
boolean useBytesMessage =
msgType != null && JMSConstants.JMS_BYTE_MESSAGE.equals(msgType) ||
contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) > -1;
OutputStream out;
StringWriter sw;
if (useBytesMessage) {
BytesMessage bytesMsg = session.createBytesMessage();
sw = null;
out = new BytesMessageOutputStream(bytesMsg);
message = bytesMsg;
} else {
sw = new StringWriter();
try {
out = new WriterOutputStream(sw, format.getCharSetEncoding());
} catch (UnsupportedCharsetException ex) {
handleException("Unsupported encoding " + format.getCharSetEncoding(), ex);
return null;
}
}
try {