ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Header/Body Mismatch

Post new topic  Reply to topic
 Header/Body Mismatch « View previous topic :: View next topic » 
Author Message
MrRothstein
PostPosted: Thu Mar 01, 2007 11:06 am    Post subject: Header/Body Mismatch Reply with quote

Newbie

Joined: 01 Mar 2007
Posts: 8

I'm currently porting an application from mq java api to jms. The application sends messages to a mainframe qmgr where a transaction is processed and a reply message is sent. The reply message that is sent specifies the coded character set as 500 (ebcidc)?. When i view the message using WebSphere MQ explorer the message data is jumbled. However, when i get the message using mq api classes and convert the bytes to string using
Code:
new String(bytes, "ASCII");
it looks fine. The message format is a string, when i receive the message in my mdb using jms api, it is a TextMessage, but the body is jumbled. Changing the target client to (MQ) doesn't change the type of the message. Is there a way to force the message to be a BytesMessage? Or is there some way (user exit?) to fix the header before the message is delivered to the mdb? I realize the correct thing to do is to fix the message before it's sent, but this option is not available right now.

Thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Mar 02, 2007 8:41 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Don't remember having ever tried it but I believe casting a TextMessage to a BytesMessage should work...(careful the opposite is not true) ...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
MrRothstein
PostPosted: Mon Mar 05, 2007 7:26 am    Post subject: Got it to work. Reply with quote

Newbie

Joined: 01 Mar 2007
Posts: 8

I was able to get it to work. The TextMessage doesn't implement BytesMessage. The way it seems to work, the TextMessage is sent to the client with the messageBytes field set. However, as soon as the data is retreived from the message using getText(), the bytes are deleted and the generated String is cached. I ended up using reflection on the message and retrieving the bytes field before performing any other operations on the message.

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Header/Body Mismatch
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.