Author |
Message
|
Cerberus1 |
Posted: Tue Jul 19, 2005 7:03 am Post subject: Creating WMQ headers from XML strings |
|
|
Newbie
Joined: 19 Jul 2005 Posts: 3 Location: Boeblingen, Germany
|
How can I create any WMQ header from an XML formatted string containing the WMQ header data?
e.g. following XML string contains a Properties folder, an MQMD and MQRFH2 folder and I want to create the appropriate headers in the message tree.
<Root><Properties><MessageSet></MessageSet><MessageType></MessageType><MessageFormat></MessageFormat><Encoding>546</Encoding><CodedCharSetId>0</CodedCharSetId><Transactional>TRUE</Transactional><Persistence>FALSE</Persistence><CreationTime>2005-07-19 10:02:26.410</CreationTime><ExpirationTime>-1</ExpirationTime><Priority>0</Priority><ReplyIdentifier>4d5157495a00000000000000000000000000000000000000</ReplyIdentifier><ReplyProtocol>MQ</ReplyProtocol><Topic></Topic></Properties><MQMD><SourceQueue>MAF_IN</SourceQueue><Transactional>TRUE</Transactional><Encoding>546</Encoding><CodedCharSetId>437</CodedCharSetId><Format>MQHRF2</Format><Version>2</Version><Report>0</Report><MsgType>8</MsgType><Expiry>-1</Expiry><Feedback>0</Feedback><Priority>0</Priority><Persistence>0</Persistence><MsgId>414d51205742494d42353020202020207dacdc4220001a01</MsgId><CorrelId>4d5157495a00000000000000000000000000000000000000</CorrelId><BackoutCount>0</BackoutCount><ReplyToQ> </ReplyToQ><ReplyToQMgr>WBIMB50 </ReplyToQMgr><UserIdentifier>axfdtte </UserIdentifier><AccountingToken>7736430005999938882abc3555244c07e53b2beb03000000000000000000000b</AccountingToken><ApplIdentityData> </ApplIdentityData><PutApplType>11</PutApplType><PutApplName>s\sources\mqia_new\mqwiz.exe</PutApplName><PutDate>2005-07-19</PutDate><PutTime>10:02:26.410</PutTime><ApplOriginData> </ApplOriginData><GroupId>000000000000000000000000000000000000000000000000</GroupId><MsgSeqNumber>1</MsgSeqNumber><Offset>0</Offset><MsgFlags>0</MsgFlags><OriginalLength>-1</OriginalLength></MQMD><MQRFH2><CodedCharSetId>1208</CodedCharSetId><NameValueCCSID>1208</NameValueCCSID><Test><Dnq><Completion><Code>Ok</Code></Completion></Dnq></Test><Format></Format><mcd><Msd>none</Msd></mcd></MQRFH2></Root> |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 19, 2005 7:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'll have to use "Set".
I don't think you can use the Mapping nodes, even if you made a message set for your XML. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Cerberus1 |
Posted: Tue Jul 19, 2005 7:18 am Post subject: |
|
|
Newbie
Joined: 19 Jul 2005 Posts: 3 Location: Boeblingen, Germany
|
The problem with the Set is that I don't know the type of the single header fields. Because I have to support any WMQ header I can't do it hard coded. When I use the Set for a header field of type integer I will get an error because the value in the XML string is of type character. And I currently found no way to determine the type of the different header fields. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 19, 2005 7:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Cerberus1 wrote: |
The problem with the Set is that I don't know the type of the single header fields. Because I have to support any WMQ header I can't do it hard coded. When I use the Set for a header field of type integer I will get an error because the value in the XML string is of type character. And I currently found no way to determine the type of the different header fields. |
You will have to code a big CASE statement based on the field name, and use CAST as necessary, and code for error handling. The types for each of the header fields are completely documented in the Application Programming Reference.
You could attempt a tree copy, from InputRoot.XML.MQMD to OutputRoot.MQMD, and hope that the parsers will handle this for you. I won't guarantee it, though. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Cerberus1 |
Posted: Tue Jul 19, 2005 8:06 am Post subject: |
|
|
Newbie
Joined: 19 Jul 2005 Posts: 3 Location: Boeblingen, Germany
|
I already tried all this things you mentioned. Unfortunately the parsers don't handle this for me on a tree copy. And I don't want to code the big CASE statement. In other words, there is no way in doing this. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 19, 2005 8:08 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
There is a way of doing this.
You don't like it, but it's there.
 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|