Author |
Message
|
yortch |
Posted: Fri Aug 14, 2009 1:40 pm Post subject: How to format XML in user trace (WMB 6.1) |
|
|
Apprentice
Joined: 30 Aug 2004 Posts: 34
|
I have a user trace node that I'm using to log XML data, however the output contains characters escaped in hexadecimal:
Code: |
2009-08-14 17:30:40.869253 Request Received: ( ['xmlnsc' : 0xaf85d8]
(0x01000000:Folder)urn:enterprise.soap.sforce.com:login = (
(0x03000000:PCDataField)urn:enterprise.soap.test.com:username = 'username@domain.con' (CHARACTER)
(0x03000000:PCDataField)urn:enterprise.soap.sforce.com:password = 'mypwd' (CHARACTER)
)
) |
I'd like the output to contain valid XML. This is the pattern that I'm using:
Quote: |
${CURRENT_TIMESTAMP} Request Received: ${Root.XMLNSC} |
Is there a "format" function I can use? Or a different property I should use?
Thanks in advanced! |
|
Back to top |
|
 |
fschofer |
Posted: Fri Aug 14, 2009 3:50 pm Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
|
Back to top |
|
 |
kimbert |
Posted: Sat Aug 15, 2009 3:05 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think you are getting confused. This:
Code: |
['xmlnsc' : 0xaf85d8] |
is telling you the name of the parser and its unique identifier. The '0xaf85d8' is not 'characters escaped in hexadecimal'.
Also, the Trace ( not 'User Trace' ) node is for showing you the contents of the message tree. The message tree is not XML, even if it was created by an XML parser. It is a logical representation of your message.
If you want to see what your message tree would look like if it was written by the XMLNSC parser, then use ASBITSTREAM to turn the message tree into an XML bit stream. You can even trace the result if you want to.
But...
Quote: |
I have a user trace node that I'm using to log XML data |
Don't use the Trace node for logging - it's a diagnostic tool, and is meant to help you debug your message flows. Sorry if that was what you meant by 'log'. |
|
Back to top |
|
 |
smdavies99 |
Posted: Sat Aug 15, 2009 11:11 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
kimbert wrote: |
Don't use the Trace node for logging |
sigh!
I've lost count of the number of production systems I have come upon that do that very thing. Many have been around since V2.1 days (and one from 2.0.1). I do try to persuade them to change this but almost without exception I'm doomed to failure.
In these days of Email & FileOutput nodes, is it daft to rely on the output to trace files for error detection. You won't belive some of the 'trick' that some sites go through to 'grep' the files on a periodic basis to detect errors.
'If it ain't broke then don't fix it' is probably worse here than 'defective by design'
(now where is the 'head in sand' Emoticon when you need it?) _________________ 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 |
|
 |
yortch |
Posted: Mon Aug 17, 2009 5:59 am Post subject: |
|
|
Apprentice
Joined: 30 Aug 2004 Posts: 34
|
kimbert wrote: |
Don't use the Trace node for logging - it's a diagnostic tool, and is meant to help you debug your message flows. Sorry if that was what you meant by 'log'. |
Thanks for the feedback, this is very helpful. What would you recommend to use for logging? Ideally I would use the log4j supportPac (IAM3) but it may not get approved within my project. As a workaround I was evaluating the use of the trace node with a file destination. I need something that I can disable (ideally by log level: debug, warn, error) at production, i.e. similar to what most logging frameworks (e.g. log4j) provide. It should be something convenient to invoke, ideally through either a node or from ESQL. In some cases we will need to log XML, e.g. the SOAP request sent to a web service. |
|
Back to top |
|
 |
yortch |
Posted: Tue Aug 25, 2009 9:40 am Post subject: |
|
|
Apprentice
Joined: 30 Aug 2004 Posts: 34
|
Quote: |
If you want to see what your message tree would look like if it was written by the XMLNSC parser, then use ASBITSTREAM to turn the message tree into an XML bit stream. You can even trace the result if you want to. |
This is exactly what I need. I tried the ASBITSTREAM function, it seems I now need a way of converting the stream of bytes back into their character representation, which hopefully is a simple ESQL function, any suggestions? |
|
Back to top |
|
 |
jbanoop |
Posted: Tue Aug 25, 2009 10:52 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
have you tried the CAST function ? |
|
Back to top |
|
 |
yortch |
Posted: Tue Aug 25, 2009 11:10 am Post subject: |
|
|
Apprentice
Joined: 30 Aug 2004 Posts: 34
|
I just did, here is the working solution...
Code: |
CAST(ASBITSTREAM(OutputRoot.XMLNSC) AS CHARACTER CCSID 1208) |
|
|
Back to top |
|
 |
|