*
* @param msgCtx message context
* @return the content type
*/
public static String getContentType(MessageContext msgCtx) {
OMOutputFormat format = new OMOutputFormat();
String soapActionString = getSOAPAction(msgCtx);
String charSetEnc = (String) msgCtx.getProperty(
Constants.Configuration.CHARACTER_SET_ENCODING);
if (charSetEnc != null) {
format.setCharSetEncoding(charSetEnc);
} else {
OperationContext opctx = msgCtx.getOperationContext();
if (opctx != null) {
charSetEnc = (String) opctx.getProperty(
Constants.Configuration.CHARACTER_SET_ENCODING);
}
}
// If the char set enc is still not found use the default
if (charSetEnc == null) {
charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
format.setSOAP11(msgCtx.isSOAP11());
format.setCharSetEncoding(charSetEnc);
String encoding = format.getCharSetEncoding();
String contentType = format.getContentType();
if (encoding != null) {
contentType += "; charset=" + encoding;
}