Re: MQMQ MsgID - valid characters
I also convert the msgId into a string, as Dennis suggested. If interested, in Java, I use the 1st method below to convert the byte array to a string, and the 2nd to convert back from a string. Regards, Alan /** * Converts a array of bytes into hexadecimal string representation. * * @param byteArray a byte array * @return a String. */ public static String toHexString(byte[] byteArray) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < byteArray.length; i++) { buffer.append(Integer.toHexString((byteArray[i] >> 4) & 0xf)); buffer.append(Integer.toHexString((byteArray[i]) & 0xf)); } return buffer.toString(); } /** * Converts a hex string to a byte array. * Permits upper or lower case hex. * * @param hexString String must have even number of characters. * and be formed only of digits 0-9 A-F or * a-f. No spaces, minus or plus signs. * @return corresponding byte array. */ public static byte[] fromHexString(String hexString) { int stringLength = hexString.length(); if ((stringLength & 0x1) != 0) { throw new IllegalArgumentException(); } byte[] byteArray = new byte[stringLength / 2]; for (int i = 0, j = 0; i < stringLength; i += 2, j++) { int high = charToNibble(hexString.charAt(i)); int low = charToNibble(hexString.charAt(i + 1)); byteArray[j] = (byte) ((high << 4) | low); } return byteArray; } /** * Converts a single char to corresponding nibble. * * @param c char to convert. must be 0-9 a-f A-F, no * spaces, plus or minus signs. * @return corresponding integer */ private static int charToNibble(char c) { if ('0' <= c && c <= '9') { return c - '0'; } else if ('a' <= c && c <= 'f') { return c - 'a' + 0xa; } else if ('A' <= c && c <= 'F') { return c - 'A' + 0xa; } else { throw new IllegalArgumentException("Invalid hex character: " + c); } } "Miller, Dennis" <[EMAIL PROTECTED]> Sent by: MQSeries List <[EMAIL PROTECTED]> 21/11/2002 06:47 AM Please respond to MQSeries List To: [EMAIL PROTECTED] cc: Subject: Re: MQMQ MsgID - valid characters You should not pass the msgid in XML without converting it to a string first. You could do like JMS and convert each half-byte to the single text character used in hex notation, i.e. "0"-"F". Of course, msgid is then transported in 48 bytes, which needs to be reversed at the other end. > -Original Message- > From: Pope, Ben [SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, November 20, 2002 8:36 AM > To: [EMAIL PROTECTED] > Subject: MQMQ MsgID - valid characters > > > I have a situation where I need to pass the MsgId contents as part of an > XML message. > What I've found in the docs describes how the field in constructed by the > queue manger > but it is described as being simply "a byte field". Are there any details > as to what byte > range could be used? Specifically, codes between 0x00 and 0x20 are > considered invalid > XML and if they can be included in the MsgId field then I need to account > for that > possibility. > > Thanks, Ben > Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive This email is intended for the named recipient only. The informationcontained in this message may be confidential, or commerciallysensitive. If you are not the intended recipient you must not reproduceor distribute any part of the email, disclose its contents to any otherparty, or take any action in reliance on it. If you have received thisemail in error, please contact the sender immediately. Please deletethis message from your computer.
Re: MQMQ MsgID - valid characters
You should not pass the msgid in XML without converting it to a string first. You could do like JMS and convert each half-byte to the single text character used in hex notation, i.e. "0"-"F". Of course, msgid is then transported in 48 bytes, which needs to be reversed at the other end. > -Original Message- > From: Pope, Ben [SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, November 20, 2002 8:36 AM > To: [EMAIL PROTECTED] > Subject: MQMQ MsgID - valid characters > > > I have a situation where I need to pass the MsgId contents as part of an > XML message. > What I've found in the docs describes how the field in constructed by the > queue manger > but it is described as being simply "a byte field". Are there any details > as to what byte > range could be used? Specifically, codes between 0x00 and 0x20 are > considered invalid > XML and if they can be included in the MsgId field then I need to account > for that > possibility. > > Thanks, Ben > Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Re: MQMQ MsgID - valid characters
Title: MQMQ MsgID - valid characters Ben, You may have a problem. The MsgId field is in the following format: 1-4 is a constant; either 'CSQ ' or 'AMQ ' 5-16 is the first 12 characters of the queue manager name 17-24 is a time stamp (a binary number), TOD clock on z/900, system clock from other servers It could be possible to hit a binary number sequence which may give you trouble. The only thing you may be able to do is convert the 8 byte binary number to 16 bytes of character data, pass it along and then reconvert back to binary at the other end. Pope, Ben wrote: I have a situation where I need to pass the MsgId contents as part of an XML message. What I've found in the docs describes how the field in constructed by the queue manger but it is described as being simply "a byte field". Are there any details as to what byte range could be used? Specifically, codes between 0x00 and 0x20 are considered invalid XML and if they can be included in the MsgId field then I need to account for that possibility. Thanks, Ben -- Regards, Thomas DunlapChief Technology Officer[EMAIL PROTECTED] Themis, Inc.http://www.themisinc.com1 (800) 756-3000
Re: MQMQ MsgID - valid characters
Ben, I believe you must be able to account for all possible byte values between 0x00 and 0xFF unless you generate the message IDs yourself. Even if the MQ generated IDs don't use all possible byte values now, they very well may in the future. Regards, Chris "Pope, Ben" cc: Sent by: Subject: MQMQ MsgID - valid characters MQSeries List 11/20/02 10:35 AM Please respond to MQSeries List I have a situation where I need to pass the MsgId contents as part of an XML message. What I've found in the docs describes how the field in constructed by the queue manger but it is described as being simply "a byte field". Are there any details as to what byte range could be used? Specifically, codes between 0x00 and 0x20 are considered invalid XML and if they can be included in the MsgId field then I need to account for that possibility. Thanks, Ben Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Re: MQMQ MsgID - valid characters
If you are using the Windows COM object model, you can get or put the MsgId as Hex characters (E2A1B3F4, etc.) ; then you can use this as a 'string' and save that in the XML. From: "Pope, Ben" <[EMAIL PROTECTED]> on 11/20/2002 11:35 AM Please respond to MQSeries List <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: Subject: MQMQ MsgID - valid characters I have a situation where I need to pass the MsgId contents as part of an XML message. What I've found in the docs describes how the field in constructed by the queue manger but it is described as being simply "a byte field". Are there any details as to what byte range could be used? Specifically, codes between 0x00 and 0x20 are considered invalid XML and if they can be included in the MsgId field then I need to account for that possibility. Thanks, Ben Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
Re: MQMQ MsgID - valid characters
Title: MQMQ MsgID - valid characters Ben, The MsgId can indeed contain characters that are invalid XML. Typically when we have had a need to pass around a MsgId in XML, we will encode the entrire MsgId as base 16 or base 64. Hope this helps, Bill Reiss Developer CommerceQuest, Inc. Enabling the Dynamic Enterprise www.commercequest.com -Original Message-From: Pope, Ben [mailto:[EMAIL PROTECTED]]Sent: Wednesday, November 20, 2002 11:36 AMTo: [EMAIL PROTECTED]Subject: MQMQ MsgID - valid characters I have a situation where I need to pass the MsgId contents as part of an XML message. What I've found in the docs describes how the field in constructed by the queue manger but it is described as being simply "a byte field". Are there any details as to what byte range could be used? Specifically, codes between 0x00 and 0x20 are considered invalid XML and if they can be included in the MsgId field then I need to account for that possibility. Thanks, Ben