Announcement Announcement Module
No announcement yet.
JMSMessage Content-Type or contentType Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMSMessage Content-Type or contentType

    Hi all...

    I've been looking at the s interface:

     * Declares useful transport constants.
     * @author Arjen Poutsma
     * @since 1.0.0
    public interface TransportConstants {
        /** The "Content-Id" header. */
        String HEADER_CONTENT_ID = "Content-Id";
        /** The "Content-Length" header. */
        String HEADER_CONTENT_LENGTH = "Content-Length";
        /** The "Content-Transfer-Encoding" header. */
        String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
        /** The "Content-Type" header. */
        String HEADER_CONTENT_TYPE = "Content-Type";
        /** The "SOAPAction" header. */
        String HEADER_SOAP_ACTION = "SOAPAction";
    I've also been testing the new SOAP/JMS features in SpringWS 1.5M1 and found out something unusual...
    In the class ion the following lines :
    // some SAAJ implementations (Axis 1) do not have a Content-Type header by default
    MimeHeaders headers = message.getMimeHeaders();
                if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_CONTENT_TYPE))) {
                    headers.addHeader(TransportConstants.HEADER_CONTENT_TYPE, SoapVersion.SOAP_11.getContentType());
                    if (message.saveRequired()) {
    set the mime headers. Which is fine. One of these headers is the "Content-Type" header. As far as i know, this header(attribute actually i think) is named "contentType" when sending JMSMessages.

    I've managed to wire-up a springWS based SOAP/JMS service which does nothing but throw a RuntimeException. This exception gets handled by the
    and subsequently, a SOAPFault would be sent. The whole things crumbles down when setting the before mentioned "Content-Type" attribute on the JMSMessage...When i debug and manually set the name of the header to "contentType", everything works fine.
    I was wondering if the value
    /** The "Content-Type" header. */
        String HEADER_CONTENT_TYPE = "Content-Type";
    only makes sense for HTTP messages and their headers?


  • #2
    AFAIK, there is no standard way to set the content type in JMS. So i basically used the same property names as used for HTTP and email. As it turned out, this is not such a good idea, because JMS property names cannot contain a dash. See This will be fixed for 1.5 M2.