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 API Support » I get MQRC_UNEXPECTED_ERROR when I call the ReadUTF()

Post new topic  Reply to topic
 I get MQRC_UNEXPECTED_ERROR when I call the ReadUTF() « View previous topic :: View next topic » 
Author Message
hhoang
PostPosted: Wed Nov 29, 2006 2:15 pm    Post subject: I get MQRC_UNEXPECTED_ERROR when I call the ReadUTF() Reply with quote

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
View user's profile Send private message
EddieA
PostPosted: Wed Nov 29, 2006 2:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
hhoang
PostPosted: Thu Nov 30, 2006 8:10 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 30, 2006 9:41 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 30, 2006 3:14 pm    Post subject: Reply with quote

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
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 » IBM MQ API Support » I get MQRC_UNEXPECTED_ERROR when I call the ReadUTF()
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.