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 » General IBM MQ Support » XMS - Binary messsage from Unix to Windows

Post new topic  Reply to topic
 XMS - Binary messsage from Unix to Windows « View previous topic :: View next topic » 
Author Message
riturajan
PostPosted: Fri Oct 19, 2007 4:38 am    Post subject: XMS - Binary messsage from Unix to Windows Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

hi,

I am using the IBM .NET client libraries (XMS) to access a queue on a Unix box from Windows 2003. I can get and send text message fine.

But when i get a binary message - a pdf - looks like it is getting transformed. Is there a setting i can specify to not convert the message?

The target client is MQ and not JMS. am a newbie at this - so any help will be greatly appreciated.

thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 19, 2007 4:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Which XMS Message object are you using?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
riturajan
PostPosted: Fri Oct 19, 2007 4:58 am    Post subject: Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

I get the message as IMessage. I have tried to cast it to IBytesMessage - but it throws an exception when I do that.

I have only been able to cast it to ITextMessage - but that can't be right for binary. works for the text messages that i am getting on the same queue.


MessageListener messageListener = new MessageListener(OnNewMessageCallback);

private void OnNewMessageCallback(IMessage message) {
ITextMessage tm = (ITextMessage)msg;
...
}
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 19, 2007 5:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You will need to be able to work with it as an IBytesMessage, I believe, in order to avoid having it run through Text conversion.

You may be having issues doing this because the person who wrote the message is setting MQMD.Format=MQFMT_STRING.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
riturajan
PostPosted: Fri Oct 19, 2007 6:13 am    Post subject: Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

Any idea if there is an XMSC setting that i can use to make this work. Here is how the message is being written - in java

lQuoteOutput_ms : MemoryStream = New;
lQuoteOutput_ms.Open( accessMode = SP_AM_READ_WRITE, isBinary = TRUE );
lQuoteOutput_ms.WriteBinary( source = lQuoteOutput_bin );
lQuoteOutput_ms.Close( );


lMessage_ent : LR_MessageEnt = New;
lMessage_ent.SetMemoryStream( pMessage_ms = lQuoteOutput_ms );
return lMessage_ent;



Writing the message out to MQ
Persistence is set…
Lower level output to Queue LR_AssemblyLineMaster._WriteOutputToQueue
lQueue_ent : LR_QueueEnt;
lQueue_ent = _mQCacheOut_o.GetQEnt( pQName_str = pQueueName_str
, pInputMode_int = LR_MQOO_NOT_OPEN_FOR_INPUT
, pOutputMode_b = TRUE
, pBrowseMode_b = FALSE );

-- Put object on queue for Save
_mMQResourceMgr_o.PutMessageOnQ( pMessage_ent = pMsg_ent
, pQueue_ent = lQueue_ent
, pLUOW_b = TRUE
, pReplyToQName_td = NIL
, pReplyToQMgrName_td = NIL
, pMsgID_ent = lMQID_ent
, pCorrelationID_ent = lMQID_ent
, pUserID_td = lUserID_td
, pPersistence_c = lPersistMsg_c
, pSetIdentityContext_b = FALSE
, pMessagePriority_int = pMessagePriority_int );
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Oct 19, 2007 12:16 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

I think Jeff's going down the correct path. Fix the problem on the sending side. What is the sending side putting on the MQMD's Format field?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
riturajan
PostPosted: Fri Oct 19, 2007 12:20 pm    Post subject: Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

i am checking with sender - but i don't have much control over that. Is there anything I can do at the receiving end to make this work?

thanks
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Oct 19, 2007 12:24 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

stop your consumer when they send a message and look at the MQMD yourself to see what they are setting in that field.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
riturajan
PostPosted: Fri Oct 19, 2007 12:39 pm    Post subject: Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

In looking at the trace - CreateXMSMessage() : No mcd folder found. Not a real JMS message. Trying to create a suitable WmqMessage.
16:31:55.777081 2536.1980 IBM.XMS.WMQ.WmqMsg ----+ d CreateXMSMessage() : mcd folder does not exist. messageClass set to be 'text'.

Also
JMS_IBM_Format = MQSTR

Is this what you were referring to? can you please let me know how to look at MQMD?

thanks
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Oct 19, 2007 12:57 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

I haven't used XMS, but......

It looks like they ae saying this message is character data by setting the MQMD_FORMAT to a value that says its char data (MQSTR). But the payload is not.

It seems XMS sees that in the header and is converting the character data for you, except its not char data, hence the corruption.

They need to stop setting that value. Just cause you call a dog a duck does not mean it will quack! They should leave that field blank.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 19, 2007 1:01 pm    Post subject: Reply with quote

Grand High Poobah

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

riturajan wrote:

16:31:55.777081 2536.1980 IBM.XMS.WMQ.WmqMsg ----+ d CreateXMSMessage() : mcd folder does not exist. messageClass set to be 'text'.

Also
JMS_IBM_Format = MQSTR

Is this what you were referring to? can you please let me know how to look at MQMD?

thanks

This is your problem: messageClass set to be 'text'
you need messageClass set to be 'byte'...

in XMS you should have something like
Session.createBytesMessage();

A Text message is not suitable to transfer binary data. Unless you want to double the size and do it in hex representation of a binary array....
A lot of additional work if you ask me...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
riturajan
PostPosted: Fri Oct 19, 2007 2:07 pm    Post subject: Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

fjb_saper wrote:
This is your problem: messageClass set to be 'text'
you need messageClass set to be 'byte'...

in XMS you should have something like
Session.createBytesMessage();

A Text message is not suitable to transfer binary data. Unless you want to double the size and do it in hex representation of a binary array....
A lot of additional work if you ask me...

Enjoy


I am the consumer - so i don't call createBytesMessage - i would like to be able to read the message as BytesMessage - but it is coming to me as text - can i convert it back or stop the conversion?

thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Oct 20, 2007 1:49 am    Post subject: Reply with quote

Grand High Poobah

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

riturajan wrote:

I am the consumer - so i don't call createBytesMessage - i would like to be able to read the message as BytesMessage - but it is coming to me as text - can i convert it back or stop the conversion?

thanks

I am more familiar with JMS than XMS. However having a message of class TextMessage means that the get is automatically done with convert.

At the same time a number of extra controls for String manipulations could be embedded behind the scenes, so even though the right bytes may have been written to the message I would not guarantee the message's integrity as it has been declared as Text and not Bytes. (Truncation of bytestream and other things come to mind as text is being handled differently in different programming languages.)

You really need to request from the sender that he modify his message to send a byte message when sending a pdf...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
riturajan
PostPosted: Tue Oct 23, 2007 8:46 pm    Post subject: Reply with quote

Newbie

Joined: 19 Oct 2007
Posts: 7

I was able to get this to work - by doing the following..

System.Text.Encoding oEncoder = System.Text.Encoding.GetEncoding("iso-8859-1");
byte[] bytesArr = oEncoder.GetBytes(tm.Text);

Converts it back into binary - which when written out forms a valid PDF document.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 24, 2007 8:41 pm    Post subject: Reply with quote

Grand High Poobah

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

riturajan wrote:
I was able to get this to work - by doing the following..

System.Text.Encoding oEncoder = System.Text.Encoding.GetEncoding("iso-8859-1");
byte[] bytesArr = oEncoder.GetBytes(tm.Text);

Converts it back into binary - which when written out forms a valid PDF document.


I would view this as best as a temporary solution. You just need a few special characters to throw off your game...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » XMS - Binary messsage from Unix to Windows
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.