Author |
Message
|
cadenza |
Posted: Wed May 04, 2005 11:03 pm Post subject: converting MQRFH2 to MQRFH |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi All,
I am using WMQI 2.1 CSD 07.
I receive MQRFH2 messages in input. How do I modify the header and send as MQRFH header?
Thanks. |
|
Back to top |
|
 |
EddieA |
Posted: Thu May 05, 2005 8:42 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Write some ESQL.
But why do you want to convert them.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
vmcgloin |
Posted: Mon May 09, 2005 1:03 am Post subject: |
|
|
Knight
Joined: 04 Apr 2002 Posts: 560 Location: Scotland
|
Or modify the sending application if that is appropriate. I think if you look at the Using Java book you'll find a BROKERVER or BrokerVersion attribute of the ConnectionFactory that can be set to ...V1 for the RFH header. I seem to recall it only applies to PubSub not PtP messages though so it might not suit your application.
I'm also curious why you want to convert it.
Cheers,
Vicky |
|
Back to top |
|
 |
cadenza |
Posted: Thu May 19, 2005 10:17 pm Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi All,
The publication end is publishing MQRFH2 and BLOB format. Previously they used to publish MQRFH and string format. The recieving application doesnt wish to change their code.
So we have to convert the MQRFH2 message in BLOB to MQRFH in String format. |
|
Back to top |
|
 |
cadenza |
Posted: Thu May 19, 2005 10:33 pm Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi All,
I have landed up in trouble converting the message.
My message flow is as follows:
Input -> Compute1 -> RouteToLabel
Label1 -> RCD1 -> Compute2 -> Ouptut
Label2 -> RCD2 -> Compute3 -> Ouptut
Input - Message is taken as BLOB
Compute1 - Message is identified and routed appropriately.
RCD1, RCD2 - The input xml message is converted to MRM.
Compute2, Compute3: Message header processing code as follows:
Copy Message Headers;
SET OutputRoot.MQMD.Format = 'MQHRF';
SET OutputRoot.MQRFH.Format = 'MQSTR';
SET OutputRoot.MQRFH.MQPSCommand = 'Publish';
SET OutputRoot.MQRFH.MQPSTopic = 'abc/def/ghi';
DETACH OutputRoot.MQRFH2;
The output obtained seems to be fine, and it is similar to the one running successfully in production.
However the recieving application is crashing. The error reported is as follows:
Waiting For Message..
Message received calling Handle Event
Exception in thread "main" java.lang.StringIndexOutOfBoundsException:
String index out of range: -1
at java.lang.String.substring(String.java:1474)
at java.lang.String.substring(String.java:1447)
at ........................................
Could anybody please help me? I am not sure what is wrong with the message. Am I messing up with the header or is the output message not a String format at all? |
|
Back to top |
|
 |
fschofer |
Posted: Thu May 19, 2005 11:12 pm Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
Hi,
how are the other fields of the MQRFH in the output message filled ?
Maybe its a problem with StrucLength or CodedCharSetId, Encoding
You may try copying some of these field form MQRFH2 to MQRFH
For more information on RFH Headers look into
WebSphere MQ Application Programming Reference
=>
Chapter 16. MQRFH – Rules and formatting header
Chapter 17. MQRFH2 – Rules and formatting header 2
Greetings
Frank |
|
Back to top |
|
 |
cadenza |
Posted: Fri May 20, 2005 1:47 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi,
If I view the message then it looks like the following:
52 46 48 20 01 00 00 00 RFH ....
50 00 00 00 11 01 00 00 P.......
1B 04 00 00 4D 51 53 54 ....MQST
52 20 20 20 00 00 00 00 R ....
4D 51 50 53 43 6F 6D 6D MQPSComm
61 6E 64 20 50 75 62 6C and Publ
69 73 68 20 4D 51 50 53 ish MQPS
54 6F 70 69 63 20 41 44 Topic AD
53 2F 4E 4F 54 45 53 2F S/NOTES/
4E 45 4D 45 53 49 53 00 NEMESIS.
3C 3F 78 6D 6C 20 76 65 <?xml ve
I used trace nodes at the following two locations:
Label1 -> RCD1 -> Trace1 ->Compute2 -> Trace2 -> Output.
I found that the fields CodedCharSetId, Encoding are same in both i.e. 437 and 546 respectively. |
|
Back to top |
|
 |
cadenza |
Posted: Fri May 20, 2005 8:21 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi,
I am curious about the message header values.
For eg:
52 46 48 20 01 00 00 00 RFH ....
50 00 00 00 11 01 00 00 P.......
In the above extract in the second line there is a value 'P'. I am not sure as to what the value denotes. Is it possible to decipher the header. I am not sure if I have landed up with a malformed header, though it looks ok to me. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri May 20, 2005 8:24 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
cadenza wrote: |
Is it possible to decipher the header. |
Yes.
The Application Programming Reference contains a complete specification of the MQRFH2 and the MQRFH header records. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
cadenza |
Posted: Fri May 20, 2005 9:19 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi jeff,
Thanks for your mail.
You are correct about the manual. I have seen it. Yet using the manual and by looking at the message I am not able to understand what the value 'P' stands for.
Actually I dont have access to applications that are setting the header and so I need to come to a conclusion by looking at the message.
I am providing an extract of the message running in production which is being parsed correctly.
52 46 48 20 00 00 00 01 RFH ....
00 00 00 50 00 00 01 11 ...P....
00 00 04 1B 4D 51 53 54 ....MQST
52 20 20 20 00 00 00 00 R ....
20 4D 51 50 53 43 6F 6D MQPSCom
6D 61 6E 64 20 50 75 62 mand Pub
6C 69 73 68 20 4D 51 50 lish MQP
53 54 6F 70 69 63 20 41 STopic A
44 53 2F 4E 4F 54 45 53 DS/NOTES
2F 4E 45 4D 45 53 49 53 /NEMESIS
3C 3F 78 6D 6C 20 76 65 <?xml ve
From the above extract we find that though the header generated by me looks similar to the above there are certain subtle differences. They are as follows:
3 dots before P
A blank space before MQPS
No dot after the topic ends
Is it possible for me to change my code so that I can generate an exact replica of the above message? Maybe it can solve my problem.
Kindly help me. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri May 20, 2005 9:29 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
[quote="cadenza"]Yet using the manual and by looking at the message I am not able to understand what the value 'P' stands for. [/code]
The APR says that the headers consist of a series of fixed length fields, and gives you the complete type for each of those fields.
So, for example, the APR lists the Visual Basic Declaration for the RFH header as
Code: |
Visual Basic declaration
Type MQRFH
StrucId As String*4 'Structure identifier'
Version As Long 'Structure version number'
StrucLength As Long 'Total length of MQRFH including'
'NameValueString'
Encoding As Long 'Numeric encoding of data that follows'
'NameValueString'
CodedCharSetId As Long 'Character set identifier of data that'
'follows NameValueString'
Format As String*8 'Format name of data that follows'
'NameValueString'
Flags As Long 'Flags'
End Type
|
It also says that the StrucID must contain the constant "RFHb", where "b" means "space". It then says that the NEXT field in the structure is a Long integer, that contains the total length of the header, including the total length of the NameValueString field that follows the fixed length fields described above. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EddieA |
Posted: Fri May 20, 2005 10:00 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Different "endian-ness". I would check that the Encoding (and maybe the CCSID for good measure) in the MQMD are correct.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
cadenza |
Posted: Sun May 22, 2005 10:05 pm Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi Eddie,
How do I override the values of Encoding and CCSID.
I have used the following ESQL:
Copy Message Headers;
SET OutputRoot.MQMD.Format = 'MQHRF';
SET OutputRoot.MQRFH.Encoding = 273;
SET OutputRoot.MQRFH.CodedCharSetId = 1051;
SET OutputRoot.MQRFH.Format = 'MQSTR';
SET OutputRoot.MQRFH.MQPSCommand = 'Publish';
SET OutputRoot.MQRFH.MQPSTopic = 'abc/def/ghi';
DETACH OutputRoot.MQRFH2;
However the two values remain the same as obtained from input. |
|
Back to top |
|
 |
cadenza |
Posted: Mon May 23, 2005 2:34 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 48
|
Hi All,
I found some success at last.
I added the command SET OutputRoot.MQMD.CodedCharSetId = 1051 and found that the output messages were coming as 1051.
So my current msg looks like:
52 46 48 20 00 00 00 01 RFH ....
00 00 00 50 00 00 01 11 ...P....
00 00 04 1B 4D 51 53 54 ....MQST
52 20 20 20 00 00 00 00 R ....
4D 51 50 53 43 6F 6D 6D MQPSComm
61 6E 64 20 50 75 62 6C and Publ
69 73 68 20 4D 51 50 53 ish MQPS
54 6F 70 69 63 20 41 44 Topic AD
53 2F 4E 4F 54 45 53 2F S/NOTES/
4E 45 4D 45 53 49 53 00 NEMESIS.
3C 3F 78 6D 6C 20 76 65 <?xml ve
***********************************
The production msg again:
52 46 48 20 00 00 00 01 RFH ....
00 00 00 50 00 00 01 11 ...P....
00 00 04 1B 4D 51 53 54 ....MQST
52 20 20 20 00 00 00 00 R ....
20 4D 51 50 53 43 6F 6D MQPSCom
6D 61 6E 64 20 50 75 62 mand Pub
6C 69 73 68 20 4D 51 50 lish MQP
53 54 6F 70 69 63 20 41 STopic A
44 53 2F 4E 4F 54 45 53 DS/NOTES
2F 4E 45 4D 45 53 49 53 /NEMESIS
3C 3F 78 6D 6C 20 76 65 <?xml ve
Still two more points of difference exists, which I am not able to simulate.
1. A space before MQPS
2. No '00' after the topic.
Any ideas??? |
|
Back to top |
|
 |
EddieA |
Posted: Mon May 23, 2005 8:13 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
I added the command SET OutputRoot.MQMD.CodedCharSetId = 1051 and found that the output messages were coming as 1051. |
You must have changed the Encoding as well. CCSID only affects the Strings, not the Integers.
Quote: |
Still two more points of difference exists, which I am not able to simulate.
1. A space before MQPS
2. No '00' after the topic. |
Because the application that is writing this is broken. The one coming from WMQI is correct.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|