javarubyspring-integrationstomp

stomp content-type header set to plain for xml content


I'm sending a XML content to ActiveMQ from ruby script using stomp

I'm explicitly setting the content-type header toapplication/xml;charset=utf-8 as shown below

client.publish queue, xml, {'content-type'=>'application/xml;charset=utf-8'}

But when I read the message from a java client that uses spring-integration to read the message the content-type is text/plain.

As a result when unmarshaller is invoked the parsing is failed with the exception

1448446 [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] WARN org.springframework.jms.listener.DefaultMessageListenerContainer - Execution of JMS message listener failed
org.springframework.integration.transformer.MessageTransformationException: failed to transform message payload
    at org.springframework.integration.transformer.AbstractPayloadTransformer.transform(AbstractPayloadTransformer.java:40)
    at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:49)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:91)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:103)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94)
    at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:223)
    at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:180)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:76)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:103)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94)
    at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:223)
    at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:180)
    at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:168)
    at org.springframework.integration.jms.ChannelPublishingJmsMessageListener.onMessage(ChannelPublishingJmsMessageListener.java:203)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
    at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.integration.core.MessagingException: Failed to create Source for payload type [[B]
    at org.springframework.integration.xml.source.DomSourceFactory.createSource(DomSourceFactory.java:62)
    at org.springframework.integration.xml.transformer.XmlPayloadUnmarshallingTransformer.transformPayload(XmlPayloadUnmarshallingTransformer.java:91)
    at org.springframework.integration.transformer.AbstractPayloadTransformer.transform(AbstractPayloadTransformer.java:33)
    ... 30 more

What could be the problem


Solution

  • Found the answer, its the header suppress_content_length adding this made it to work

    :suppress_content_length => true