|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Header/Body Mismatch |
« View previous topic :: View next topic » |
Author |
Message
|
MrRothstein |
Posted: Thu Mar 01, 2007 11:06 am Post subject: Header/Body Mismatch |
|
|
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 |
|
 |
fjb_saper |
Posted: Fri Mar 02, 2007 8:41 pm Post subject: |
|
|
 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 |
|
 |
MrRothstein |
Posted: Mon Mar 05, 2007 7:26 am Post subject: Got it to work. |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|