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 » Message has periods between each letter

Post new topic  Reply to topic
 Message has periods between each letter « View previous topic :: View next topic » 
Author Message
meaton78
PostPosted: Wed Jun 10, 2009 5:16 am    Post subject: Message has periods between each letter Reply with quote

Centurion

Joined: 16 Oct 2008
Posts: 100

I'm taking a stab at a simple c# program to easily test our services. I can connect and put/get messages fine, but when I browse the xml message with rfhutil that I am putting to the queue, it has a period between each character. In turn, the response from the broker is an invalid xml error. I've put a second message to the queue using our current method and compared the MQMD from both messages with everthing being the exact same. Has anyone ever run into this before?

Bad:
00003104 0.0.0.f.0.f.0.f.0.f.1.f.0.f.0.f.
00003136 0.f.0.f.0.f.0.f.0.f.0.f.0.f.0.f.

Good:
00001728 0c1f0f0f0f00000003c4040404040404
00001760 04040404040404040404040404040404

Code:
requestQueue = queueManager.AccessQueue(txtRequestQueue.Text, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
requestMessage = new MQMessage();
requestMessage.WriteString(strInputMsg);
requestMessage.Format = MQC.MQFMT_STRING;
requestMessage.Report = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;

requestMessage.MessageType = MQC.MQMT_REQUEST;
queuePutMessageOptions = new MQPutMessageOptions();
requestMessage.CharacterSet = 437;
requestMessage.ReplyToQueueName = txtResponseQueue.Text;
requestQueue.Put(requestMessage, queuePutMessageOptions);
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 10, 2009 5:22 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

I'd theorise your c# is using UTF or some other double byte method to manipulate strings, leading to the unwanted characters. What happens if you don't set CCSID explicitly to 437?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Jun 10, 2009 5:42 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

MQPUT does not convert the message data. You must describe it accurately in CCSID terms.

If it's 1200 (unicode) you can use that as the CCSID and the receiver can convert it to ASCII with MQGET + MQGMO_CONVERT
Back to top
View user's profile Send private message
meaton78
PostPosted: Wed Jun 10, 2009 6:31 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2008
Posts: 100

I get the same result if I do not specify any CCSID.
I changed methods from requestMessage.WriteString to requestMessage.WriteUTF and that took care of the problem. Thanks Vitor for the tip on where to look.
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Jun 10, 2009 6:43 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Watch out for the UTF Byte Order Mark being generated at the start of the message.

When viewing messages, make sure you understand what the viewing program is doing for you, it may be converting the data - make sure the application does likewise to get the same result.
Back to top
View user's profile Send private message
vol
PostPosted: Wed Jun 10, 2009 8:35 am    Post subject: Reply with quote

Acolyte

Joined: 01 Feb 2009
Posts: 69

method descriptions from the manual

Quote:
WriteUTF
public void WriteUTF(String str)
Throws IOException.

Writes a UTF string, prefixed by a 2-byte length field, into the message buffer at the current position.



Quote:
WriteString
public void WriteString(String str)
Throws IOException.

Writes a string into the message buffer at the current position, converting it to the codeset identified by the characterSet member variable.



as Vitor has said, WriteUTF will write 2 bytes at the beginning of the msg. This will make the msg invalid in XML terms.

If you use WriteString, the characterSet member variable determines the code page of the string. In the code snippet, this is not set, so the code page is 1200, UCS-2, DBCS. This is OK as long as the MD of the msg states that the msg is actually in UCS-2. If you want the msg in a single byte code page, e.g. 437 on Windows, put the statement

requestMessage.CharacterSet = 437;

BEFORE the call to WriteString
Back to top
View user's profile Send private message
meaton78
PostPosted: Wed Jun 10, 2009 8:42 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2008
Posts: 100

As stated by both vol and zpat, I noticed the message was indeed prefixed by 2 bytes using the WriteUTF. vol, you were absolutely correct in saying "requestMessage.CharacterSet = 437; BEFORE the call to WriteString". I moved it to before the write and verified that it was writing properly. I then put it to a queue that MB was reading and got back a valid response. Thanks to everyone for their input, I really appreciate it!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Message has periods between each letter
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.