You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ulhas Bhole <ul...@progress.com> on 2009/03/12 12:23:05 UTC

Servcemix jms consumer to consumer plain text message

Hi ,
I was recently trying to use servicemix-jms consumer to read some plain 
text (non-xml) message off the JMS Queue and pass it onto a bean 
endpoint. While doing this I observed if my message (JMSMessage) is 
simple plain text the jms consumer throws wstax exception for StaxIn 
interceptor.

While debugging I found that DefaultConsumerMarshaller.populateMessage() 
checks if the Message is TextMessage and creates a Soap Message and 
calls msg.setContent(...) which simply adds the contents of the 
TextMessage added into InputStream onto SoapMessage.  Later when the 
StaxInInterceptor.handleMessage() is called it assumes that the contents 
of the input Stream added onto the Soap message are XML and tries to 
create ExtendedXMLStreamReader() which essentially causes wstx exception 
since the message in input stream is plain text and not XML.


Is there any way to use the plain text message or the message coming in 
should always be some XML message? For now I simply changed the plain 
text message with XML fragment to workaround (since the contents were 
not important to me at this stage) but am I missing something?

Regards,

Ulhas Bhole

Re: Servcemix jms consumer to consumer plain text message

Posted by Adrian Trenaman <tr...@progress.com>.
Hi Ulhas,

AFAIR you can use a binary marshaller to send the plain-text file as  
an attachment to the JBI message. I think sample spring configuration  
to do this is in the archetype for servicemix-jms!

Best,
Ade.

On 12 Mar 2009, at 11:23, Ulhas Bhole wrote:

> Hi ,
> I was recently trying to use servicemix-jms consumer to read some  
> plain text (non-xml) message off the JMS Queue and pass it onto a  
> bean endpoint. While doing this I observed if my message  
> (JMSMessage) is simple plain text the jms consumer throws wstax  
> exception for StaxIn interceptor.
>
> While debugging I found that  
> DefaultConsumerMarshaller.populateMessage() checks if the Message is  
> TextMessage and creates a Soap Message and calls msg.setContent(...)  
> which simply adds the contents of the TextMessage added into  
> InputStream onto SoapMessage.  Later when the  
> StaxInInterceptor.handleMessage() is called it assumes that the  
> contents of the input Stream added onto the Soap message are XML and  
> tries to create ExtendedXMLStreamReader() which essentially causes  
> wstx exception since the message in input stream is plain text and  
> not XML.
>
>
> Is there any way to use the plain text message or the message coming  
> in should always be some XML message? For now I simply changed the  
> plain text message with XML fragment to workaround (since the  
> contents were not important to me at this stage) but am I missing  
> something?
>
> Regards,
>
> Ulhas Bhole

---
Adrian Trenaman, Consultant Fellow, PS - Opensource Center of Competence
Progress Software Corp
Shelbourne Road, Dublin 4, Ireland
---
+353-1-637-2659 (Office)
+353-1-637-2882 (Fax)
+353-86-6051026 (Mobile)
  adrian.trenaman (Skype)
----
Blog: http://trenaman.blogspot.com