Author |
Message
|
Ranodip Basu |
Posted: Wed Apr 04, 2007 1:14 pm Post subject: How to Create MQMD Header Part Using JavaCompute Node ? |
|
|
 Apprentice
Joined: 23 Sep 2004 Posts: 48
|
Hi All,
I am using WMB 6.0 and MQ 5.3. In one of our MsgFlow we are getting messages from HTTPInput node and need to put them it in a MQQueue.So to put a queue we need to add a MQMD header in output message and the Java code we have developed for that is in below :
Quote: |
MbElement mqmd = outRoot.createElementAfter("MQHMD");
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","XMLNSC"); |
as given in toolkit help
Quote: |
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac30430_.htm |
This code actually placing the MQMD as first child of ROOT i.e. before Properties. But as per my knowledge the MQMD should be placed after Properties. So we have modified the code and used as in below:
Quote: |
MbElement mqmd = outRoot.getFirstChild().createElementAfter("MQHMD");
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","XMLNSC"); |
In MQOutput node properties, we have selected Advanced-> New Message Id to assign a new message Id for output message.
But for both the cases above it not able to put message in queue and giving MQRC 2097 error. Should we need to add anything in MQMD ?
Thanks in advance,
Ranodip |
|
Back to top |
|
 |
Michael Dag |
Posted: Wed Apr 04, 2007 11:22 pm Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
use the search button and search for 2097, there are a number of posts which may fit your needs. _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Apr 05, 2007 4:06 am Post subject: Re: How to Create MQMD Header Part Using JavaCompute Node ? |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Place trace node inside flow and check your tree structure.
You will see where the problem is. I hope
Quote: |
MbElement mqmd = outRoot.getFirstChild().createElementAfter("MQHMD");
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","XMLNSC"); |
PS. Shouldn't it be:
Quote: |
MbElement mqmd = outRoot.getFirstChild().createElementAfter("MQMD");
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","MQSTR"); |
_________________ Marcin |
|
Back to top |
|
 |
Ranodip Basu |
Posted: Thu Apr 05, 2007 9:45 am Post subject: |
|
|
 Apprentice
Joined: 23 Sep 2004 Posts: 48
|
Hi Marcin,
While I am using
Quote: |
MbElement mqmd = outRoot.getFirstChild().createElementAfter("MQMD");
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","MQSTR"); |
the MQMD header is not generating and in the exception list I am getting
Quote: |
(0x03000000):Severity = 3
(0x03000000):Number = 2310
(0x03000000):Text = 'Could not create parser'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'MQMD' |
But when I have changed the code to
Quote: |
MbElement mqmd = outRoot.getFirstChild().createElementAfter("MQHMD");
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","MQSTR"); |
It is still not able to put message in queue and the trace is as in below:
THE HEADER PART:
Quote: |
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-04-05 17:27:41.820'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = ''
)
(0x01000000):MQMD = (
(0x03000000):Format = 'MQSTR'
)
(0x01000000):XMLNSC = (
(0x01000400):XmlDeclaration = (
(0x03000100):Version = '1.0'
(0x03000100):Encoding = 'UTF-8' |
THE EXCEPTION LIST:
Quote: |
(0x03000000):Severity = 3
(0x03000000):Number = 2667
(0x03000000):Text = 'Failed to put message'
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '-1'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'MQW102'
)
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '2097'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '' |
Thanks & Regards,
Ranodip |
|
Back to top |
|
 |
Ranodip Basu |
Posted: Thu Apr 05, 2007 9:48 am Post subject: |
|
|
 Apprentice
Joined: 23 Sep 2004 Posts: 48
|
Hi,
Using ESQL I am able to create a MQMd header from scratch and put the message in queue. The code is as below:
Quote: |
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.MQMD.StrucId = MQMD_STRUC_ID;
SET OutputRoot.MQMD.Version = MQMD_CURRENT_VERSION;
SET OutputRoot.MQMD.MsgType = MQMT_DATAGRAM;
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2 ;
SET OutputRoot.XMLNSC = InputRoot.XMLNSC; |
But in Java I am not able able to find how to add these values to corressponding MQMd properties ? Are MQMD_STRUC_ID, MQMD_CURRENT_VERSION etc. conatants available in MB Broker java packages ? |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Apr 05, 2007 11:31 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Another example with MQHMD. This is correct name of parser class.
Code: |
MbElement root = msg.getRootElement();
MbElement body = root.getLastChild();
MbElement mqmd = body.createElementBefore("MQHMD"); |
You mentioned that it works with ESQL but please check Message Context Arrtibute of MQOutput.
Try "Default".
Is it full message tree you showed us ? _________________ Marcin |
|
Back to top |
|
 |
Ranodip Basu |
Posted: Thu Apr 05, 2007 12:09 pm Post subject: |
|
|
 Apprentice
Joined: 23 Sep 2004 Posts: 48
|
Hi Marcin,
The problem got splved now. Yes the problem root was with Message Context property of MQOutput node. By default it comes as Pass all which I changed to Set All. So after changing it is working fine even with
Quote: |
mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Format","XMLNSC" |
.
Thanks a lot for all of your helps.
Ranodip |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Apr 05, 2007 12:22 pm Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
I forgot about this common problem at first post. _________________ Marcin |
|
Back to top |
|
 |
amitgoelamit |
Posted: Sat Jul 19, 2008 1:59 am Post subject: useful information |
|
|
Novice
Joined: 19 Jul 2008 Posts: 20
|
good ! lot of information |
|
Back to top |
|
 |
|