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 » Placing ExceptionList in an XML message for another flow

Post new topic  Reply to topic
 Placing ExceptionList in an XML message for another flow « View previous topic :: View next topic » 
Author Message
jharringa
PostPosted: Wed Jan 23, 2008 2:16 pm    Post subject: Placing ExceptionList in an XML message for another flow Reply with quote

Acolyte

Joined: 24 Aug 2007
Posts: 70

Forgive me if the solution to this has been posted already or if I am not interpreting a solution correctly but here goes:

We have the following code:

Code:

      SET OutputRoot.Properties = InputRoot.Properties;
      SET OutputRoot.MQMD = InputRoot.MQMD;
      SET OutputRoot.XMLNSC.ERRORMSG =
         ROW(SQL.BrokerName AS BROKERNAME,
            SQL.ExecutionGroupLabel AS EXECUTIONGRP,
            SQL.MessageFlowLabel AS MESSAGEFLOW,
            LogLevel AS LOGLEVEL,
            AlertEmailList AS ALERTEMAILS,
            InputRoot.MQMD AS ORIGMQMD,
            InputExceptionList AS XLIST,
            InputBody AS ORIGBODY);


It is designed to be used to send on to another flow for further exception processing. The portion that puts the InputExceptionList into the XLIST portion of the row works pretty well unless one of the Insert's Text elements contains a null value (Unicode 0x0). When this happens, we have problems parsing (which is reasonable) on the MQInput of the processing flow. One example of when this happens is when a flow is trying to CAST a field that does not exist into a DATE (yeah, should be handling that on the processing flow but we are handling errors here so processing this is important...).

What would be the preferred method of placing this into the XML message? I noticed that in the help manual they recommend doing the following to process the whole ExceptionList (which I suppose I could look for a null value) but that seems like overkill to me and it seems like there should be an easier way to do this in a way where the broker handles this for me.

Here is what I found in the broker help (probably overkill and a micromanaging solution):

Code:

-- Declare a reference for the ExceptionList
-- (in a Compute node use InputExceptionList)
DECLARE start REFERENCE TO ExceptionList.*[1];

-- Loop through the exception list children
WHILE start.Number IS NOT NULL DO
   -- more ESQL

   -- Move start to the last child of the field to which it currently points
   MOVE start LASTCHILD;
END WHILE; 


Should I be doing this and just casting every value as a CHARACTER? That seems pretty expensive to me...
Back to top
View user's profile Send private message
jharringa
PostPosted: Fri Jan 25, 2008 10:20 am    Post subject: Reply with quote

Acolyte

Joined: 24 Aug 2007
Posts: 70

Is this possibly something that is wrong with the broker in the way it generates the ExceptionList?

I suspect that I'm probably the one that is doing something wrong... but it doesn't seem like I should have to inspect the ExceptionList for invalid XML characters (such as Unicode 0x0). This is happening when I send a null reference into the CAST function to be cast as a DATE. I've fixed the code but this worries me that there might be some other characters that go into the ExceptionList that might cause this same issue.
Back to top
View user's profile Send private message
dkeister
PostPosted: Fri Jan 25, 2008 10:21 am    Post subject: Reply with quote

Disciple

Joined: 25 Mar 2002
Posts: 184
Location: Purchase, New York

I have an example of what I use for all my errors within a message flow.

http://www.redbooks.ibm.com/redpapers/pdfs/redp4043.pdf

I try to have the flow that handles this message put the exception list information into an email and send it to me. You would be surprised at how often I find out about an error before anyone else is even aware a problem has occurred.

I sometimes get more credit than I deserve when someone calls with a problem and I say something like "The message flow was not able to access the database. Call the DBA to fix the error XXXX."

Hope this helps.
_________________
Dean Keister
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kimbert
PostPosted: Fri Jan 25, 2008 12:44 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Is this possibly something that is wrong with the broker in the way it generates the ExceptionList?
No - this is something which you, the programmer, need to handle. WMB does not know whether you are intending to output the ExceptionList as XML, or as a TDS message, or as a BLOB. You have chosen to copy ExceptionList under OutputRoot.XMLNSC. It is your responsibility to ensure that the elements under OutputRoot.XMLNSC do not contain characters which are illegal according to the XML specification.

You could argue that the XMLNSC parser should automatically detect illegal characters and escape them for you. That may be useful, but would carry a performance penalty for all users.
Back to top
View user's profile Send private message
jharringa
PostPosted: Fri Jan 25, 2008 1:28 pm    Post subject: Reply with quote

Acolyte

Joined: 24 Aug 2007
Posts: 70

Just as I suspected... Thank you for the input.

Is there a good way of making sure that the values that I copy into the XMLNSC folder are going to be compliant with the XML spec? I've been looking through a lot of docs and I haven't seen anything that points me to a robust solution (I'm fairly certain that I'm missing something). Should I only be worried about cleaning the Text from Inserts?




BTW, I am in 6.1
Back to top
View user's profile Send private message
chrisc
PostPosted: Tue Jan 29, 2008 8:01 pm    Post subject: Reply with quote

Voyager

Joined: 19 Mar 2006
Posts: 77

I think the only way you can guarantee that your message contents are not going to contain invalid elements is to cast it as a BLOB, then cast that to a string, but you obviously need the ability to unravel it at the other end.

The simple fact is that XML is not intended as a transport for binary data, and if you want to put binary data in XML you need to do something like URLEncode it, but since MB doesn't have any such function you'll need to work around it in other ways.

You could always copy the InputExceptionList to a temporary location and use a Java class to URLEncode or Base64Encode the InsertText values.
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 » Placing ExceptionList in an XML message for another flow
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.