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

  • JMSMessage Content-Type or contentType

    Hi all...

    I've been looking at the org.springframework.ws.transport.TransportConstant s interface:

    Code:
    package org.springframework.ws.transport;
    
    /**
     * 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 org.springframework.ws.soap.saaj.Saaj12Implementat ion the following lines :
    Code:
    // 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()) {
                        message.saveChanges();
                    }
                }
    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
    Code:
    org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver
    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
    Code:
    /** The "Content-Type" header. */
        String HEADER_CONTENT_TYPE = "Content-Type";
    only makes sense for HTTP messages and their headers?

    Thanks&Cheers!!

  • #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 http://opensource.atlassian.com/proj...browse/SWS-258. This will be fixed for 1.5 M2.

    Comment

    Working...
    X