I have a C# client for fetching IBM mq messages. I am trying to read byte messages from the queue. But I receive the following error.
IBM.XMS.MessageEOFException: CWSMQ0136I: An attempt was made to read beyond the end of the message. An attempt was made to read beyond the end of the message. This may be a normal condition if an application has been coded to read variable length data using the JMS 1.0.2 specification. If necessary, recode the application to use the new getBodyLength method. at IBM.XMS.Client.Impl.XmsBytesMessageImpl.ReadUTF()
I tried with the following code in C#,
var msg = (IBytesMessage)message;
var result = msg.ReadUTF();
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(result);
The error suggests I use getBodyLength() in java I have seen
byte[] uploadPayload = null;
BytesMessage bytesMessage = (BytesMessage) receivedMessage;
uploadPayload = new byte[(int) bytesMessage.getBodyLength()];
bytesMessage.readBytes(uploadPayload);
But how do I do that in C#. I see that it's the GetBodyLength is not available ?