Author |
Message
|
hhoang |
Posted: Wed Nov 29, 2006 2:15 pm Post subject: I get MQRC_UNEXPECTED_ERROR when I call the ReadUTF() |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
I get this error MQRC_UNEXPECTED_ERROR when I call the ReadUTF() method. I am using MQ V5.3. A friend of my is using the same routine and no error. We both using the same .NET assembly version and his product version is 6.0.2.0.
Code: |
private void ReceiveMQ_Click(object sender, System.EventArgs e)
{
try
{
MQEnvironment.Hostname = "101.222.212.XXX";
MQEnvironment.Channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.Port = 1545;
MQQueueManager qMgr = new MQQueueManager("TA1.QA.QM");
String qName = "QAL.SQ.QA.01";
int OpenOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
MQQueue system_default_local_queue =
qMgr.AccessQueue(qName, OpenOptions);
MQMessage retrievedMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
system_default_local_queue.Get(retrievedMessage, gmo);
String msgText = retrievedMessage.ReadUTF();
MessageBox.Show("The message is: " + msgText);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
|
The same routine but if I change the readingUTF() method to to ReadString() then I don't get any problems but I can not able to read the text. Do you have any ideas? |
|
Back to top |
|
 |
EddieA |
Posted: Wed Nov 29, 2006 2:38 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Is the data you are reading in the correct format for readUTF():
Quote: |
The string in the message consists of a 2-byte length followed by the character data.
|
Cheers. _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
hhoang |
Posted: Thu Nov 30, 2006 8:10 am Post subject: |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
The pepole who put the messages on the queue confirm that they used UTF-8 format. My friend can read it. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 30, 2006 9:41 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
UTF-8 is NOT the same as the results of a writeUTF call. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 30, 2006 3:14 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You need to use writeUTF and readUTF as a pair, on both ends. Otherwise just use the standard text API...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|