ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Simplest way to output XML in WMB 6.1?

Post new topic  Reply to topic
 Simplest way to output XML in WMB 6.1? « View previous topic :: View next topic » 
Author Message
yortch
PostPosted: Tue Aug 25, 2009 7:22 am    Post subject: Simplest way to output XML in WMB 6.1? Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

I need to be able to log/print the XML that is sent to a Web Service for debugging purposes. What is the easiest way to accomplish this? Ideally I'd like to accomplish this via a built-in (or custom) ESQL function that returns the XML as a string so that I can add it to "debug" level logs.
Any pointers/suggestions for doing this will be appreciated.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue Aug 25, 2009 7:34 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

The easiest way is to use a trace node passing it the ${InputRoot.XMLNSC} but this isnt really suitable for production systems.

Failing this, if you really do want to log each and every message id look at storing it as a CLOB in a DB somewhere.

I've got a feeling that if you add it to the "debug" user trace logs, the data will get truncated so this probably isnt your best solution
Back to top
View user's profile Send private message
yortch
PostPosted: Tue Aug 25, 2009 7:50 am    Post subject: Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

I've tried this, the problem is that the output is not formatted in XML.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Aug 25, 2009 8:04 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You mean you want to get a character representation of the message bitstream?
Back to top
View user's profile Send private message
yortch
PostPosted: Tue Aug 25, 2009 8:12 am    Post subject: Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

mqjeff wrote:
You mean you want to get a character representation of the message bitstream?
Exactly
Back to top
View user's profile Send private message
yortch
PostPosted: Tue Aug 25, 2009 10:03 am    Post subject: Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

I figured out a way to do this using Java. If anyone can add the ESQL equivalent please do...

Caller flow:
Code:
DECLARE xmlString CHARACTER;
SET xmlString = common.XmlToString(OutputRoot.XMLNSC);


ESQL function (to call Java function):
Code:

CREATE FUNCTION XmlToString(IN xml REFERENCE)
   RETURNS CHARACTER
   LANGUAGE JAVA EXTERNAL NAME "common.utilities.log.LogHelper.xmlToString";


Java function:
Code:

public static String xmlToString(MbElement xml) {
   String xmlStr = xml.toString();
   try {
      byte[] data = xml.toBitstream("", "", "", 0, 0, 0);
      xmlStr = new String(data);
   }
   catch (Exception any) {
      LOGGER.error("Error converting XML bytes into string: " + any.toString());
   }
   LOGGER.debug("XML string: " + xmlStr);
   return xmlStr;
}
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Aug 25, 2009 10:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You've already found the ASBITSTREAM esql function.

Go back to the documentation, and look for the function that will let you express a BLOB field as a CHARACTER variable.
Back to top
View user's profile Send private message
jbanoop
PostPosted: Tue Aug 25, 2009 10:46 am    Post subject: Reply with quote

Chevalier

Joined: 17 Sep 2005
Posts: 401
Location: SC

you can use the ASBITSTREAM to convert the tree into bytes. Then use a CAST to convert the bitstream into character if required.
Does this help ?
Back to top
View user's profile Send private message Yahoo Messenger
yortch
PostPosted: Tue Aug 25, 2009 11:11 am    Post subject: Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

Here is the ESQL equivalent:

Code:
CAST(ASBITSTREAM(InputExceptionList) AS CHARACTER CCSID 1208)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Simplest way to output XML in WMB 6.1?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.