Author |
Message
|
gaurav.udgir |
Posted: Mon Nov 02, 2009 9:10 pm Post subject: Problem with Monitoring Events - bitstreamdata |
|
|
Apprentice
Joined: 18 May 2009 Posts: 32
|
Hi All,
MB: 6.1.0.4
MQ: 7.0
I am facing issues with Monitoring Events. I am getting the bitstream data in events message which is in hex binary format.
<wmb:bitstreamData>
<wmb:bitstream wmb:encoding="hexBinary">4d442020020000000000000008000000ffffffff0000000022020000b501000020202020202020200000000000000000414d51205742524b36315f4445464155f95eee4a20003422000000000000000000000000000000000000000000000000000000002020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020205742524b36315f44454641554c545f51554555455f4d414e41474552202020202020202020202020202020202020202064623261646d696e202020201601051500000003bb7761dda678b71b860438ed03000000000000000000000b20202020202020202020202020202020202020202020202020202020202020200b0000005c496e7374616c6c6572735c696830335c7266687574696c2e6578653230303931313032303535343436313220202020000000000000000000000000000000000000000000000000010000000000000000000000ffffffff3c456d706c6f7965653e0d0a093c4e616d653e4761757261763c2f4e616d653e0d0a3c2f456d706c6f7965653e0d0a09</wmb:bitstream>
</wmb:bitstreamData>
I want to parse the above message using XMLNSC and get the tree structure to use the content of the message.
I am trying the following to achieve the same:
DECLARE refMessage REFERENCE TO Environment.Variables.Message;
CREATE LASTCHILD OF refMessage DOMAIN('XMLNSC') PARSE (CAST(InputRoot.XMLNSC.eventNS:event.eventNS:bitstreamData.eventNS:bitstream AS CHAR), InputRoot.MQMD.CodedCharSetId);
But getting XML parser exception.
Any help is appreciated.
Thank you.
Regards,
Gaurav |
|
Back to top |
|
 |
gaurav.udgir |
Posted: Mon Nov 02, 2009 9:21 pm Post subject: |
|
|
Apprentice
Joined: 18 May 2009 Posts: 32
|
Hi,
Sorry, pasted wrong code.
Using the following code:
DECLARE refMessage REFERENCE TO Environment.Variables.Message;
CREATE LASTCHILD OF refMessage DOMAIN('XMLNSC') PARSE (InputRoot.XMLNSC.eventNS:event.eventNS:bitstreamData.eventNS:bitstream, InputRoot.MQMD.CodedCharSetId); |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Nov 02, 2009 11:26 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Try loading the errant message binary data into a tool like rfhutil (IH03 support pack)
Then look at the binary data as XML and see if it is indeed an XML stream.
If it is not then obviously any XML based parser can't handle it.
Finally, put your message inside CODE tags as it will make it easier to read.
Your long string of data is difficult to decipher.
The preview button is your friend here. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
gaurav.udgir |
Posted: Tue Nov 03, 2009 1:34 am Post subject: |
|
|
Apprentice
Joined: 18 May 2009 Posts: 32
|
Hi,
Thank you for the response.
Sorry. Was not aware of preview feature. Next time will take care.
I have configured the payload to be in hexbinary format in the monitoring tab. When it arrives in flow which is listening to the event it comes in the format as given below. I want to extract the message from it.
As told, I tried to open the same using RFHUtil, it says that its not a XML.
Do you have any solution by which we can retrieve the message in the bitstream back in tree format.
Please revert if you need any further information.
Thank you.
Regards,
Gaurav |
|
Back to top |
|
 |
gaurav.udgir |
Posted: Tue Nov 03, 2009 2:17 am Post subject: |
|
|
Apprentice
Joined: 18 May 2009 Posts: 32
|
Hi All,
Just now found that bitstream data is containing complete message payload (MQMD headers, message etc) and is coming as HexBinary Data. Any idea how can we convert this HexBinary Data back to message tree.
Thank you.
Regards,
Gaurav |
|
Back to top |
|
 |
mgk |
Posted: Tue Nov 03, 2009 2:23 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Your bitstream is the entire messsage and so it includes an MQMD on the front. This is why it is not valid XML. Without the MQMD you have a valid XML message. Therefore you need to strip of the MQMD from the bitstream or not ask for it in the first place...
Kind Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
gaurav.udgir |
Posted: Tue Nov 03, 2009 2:33 am Post subject: |
|
|
Apprentice
Joined: 18 May 2009 Posts: 32
|
Hi Mgk,
Thank you for the response.
Yes you are right. It is having the headers. But how can I avoid the MQMD data from coming into bitstream data field?
Thank you.
Regards,
Gaurav. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 04, 2009 12:12 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Ask for an XML message with 2 fields
one for the MQMD
one for the payload.
Both fields can be hex streams...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 04, 2009 1:08 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The MQMD is a fixed-length structure. It should be possible to remove it in the BLOB domain, then reparse the message using either an RCD node or CREATE...PARSE with the DOMAIN clause. |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Nov 04, 2009 1:59 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
kimbert wrote: |
The MQMD is a fixed-length structure. It should be possible to remove it in the BLOB domain, then reparse the message using either an RCD node or CREATE...PARSE with the DOMAIN clause. |
If you look at the WMQ header file 'cmqc.h' you will find that the MQMD is a Fixed Length Structure that can vary depending upon the version of the MQMD used
To cover all your bases and develop some code that is general purpose and can cover MQMD's of all versions you will have to extract the MQMD version from the BLOB and code the length extraction accordingly. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Herbert |
Posted: Tue Nov 17, 2009 7:03 am Post subject: |
|
|
 Centurion
Joined: 05 Dec 2006 Posts: 146 Location: Leersum, The Netherlands
|
gaurav.udgir wrote: |
Using the following code:
DECLARE refMessage REFERENCE TO Environment.Variables.Message;
CREATE LASTCHILD OF refMessage DOMAIN('XMLNSC') PARSE (InputRoot.XMLNSC.eventNS:event.eventNS:bitstreamData.eventNS:bitstream, InputRoot.MQMD.CodedCharSetId); |
That's the CCSID of the Monitor message, you need the CCSID of the original message.
Terminal monitor events have always headers & body as Payload bitstream, if you want only the body you must create a "Transaction start" monitor event.
For a MQInput node, create a event with below settings:
- Select "Transaction start" as Event Source and
- Add "$Root/MQMD" as a "Event Payload" entry.
- Select "Body" as content at "Include bitstream data in payload"
- Select "Base64Binary" as encoding at "Include bitstream data in payload"
Below compute node works with above event settings.
Code: |
CREATE COMPUTE MODULE Test_Monitoring_Compute
CREATE PROCEDURE base64Decode(IN source CHAR)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.javacompute.Base64.decode";
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE wmb NAMESPACE 'http://www.ibm.com/xmlns/prod/websphere/messagebroker/6.1.0/monitoring/event';
DECLARE data REFERENCE TO InputRoot.XMLNSC.wmb:event.wmb:bitstreamData.wmb:bitstream;
DECLARE mqmd REFERENCE TO InputRoot.XMLNSC.wmb:event.wmb:applicationData.wmb:complexContent.MQMD;
CREATE LASTCHILD OF Environment.Variables.orgMessage DOMAIN('XMLNSC')
PARSE ( base64Decode(data) ENCODING mqmd.Encoding CCSID mqmd.CodedCharSetId; );
RETURN TRUE;
END;
END MODULE; |
|
|
Back to top |
|
 |
|