views:

44

answers:

1

I am using .net client to post mesages to MQ server which is hosted on Unix. It is added some control character before the messages. Like below

**^CD**<request> 

The Queue connection is through SSL Table channel connection. The code i am using is

MQQueueManager queueManager = new MQQueueManager ; 
int openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_BIND_NOT_FIXED + MQC.MQOO_FAIL_IF_QUIESCING; 
MQQueue Queue = queueManager.AccessQueue("TestQueue", openOptions); 
MQMessage queueMessage = new MQMessage(); 
queueMessage.WriteUTF("<request>"); 

MQPutMessageOptions MessageOptions = new MQPutMessageOptions(); 
Queue.Put(queueMessage, MessageOptions); 

please let me know what cause this special chars

+1  A: 

From IBM's own doco on WriteUTF:

This method takes an ActiveX string and writes it into the message data buffer at the current position in UTF format. The data written consists of a 2-byte length followed by the character data. DataOffset is incremented by the length of the string if the method succeeds.

If you don't want that length, consider using WriteString instead (follow that doco link above and just go up a couple of lines in the navigation pane)..

paxdiablo
Man, I'm off my game tonight. This is of course, the correct answer. :-) The link to the same doc in the v7 manual is http://bit.ly/a7YvFW I hope everyone is using the v7 classes, client an dserver by now, right? The v6 version is end-of-life as of Sep 2011 and for .Net the v7 classes are SO much better it's worth it to switch now.
T.Rob
Is there any possibility writestring strip of Len of string?
@user171523, not sure I understand. WriteString won't actually write the length like WriteUTF does so, in that sense, yes it does strip it off. Of course, if it's a variable length string and you're going to put more data after it, you should have the length in there.
paxdiablo