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 » Accessing Original Input Message after Exception

Post new topic  Reply to topic
 Accessing Original Input Message after Exception « View previous topic :: View next topic » 
Author Message
goldym
PostPosted: Tue Jul 26, 2005 11:29 am    Post subject: Accessing Original Input Message after Exception Reply with quote

Centurion

Joined: 24 Jun 2005
Posts: 116

I am using the following Exception Handling procedure that I am trying to customize. I am trying to access the original input message for my exception table however I don't know how to access the fields. I tried using a TryCatch node and the CREATE FIRSTCHILD of OutputRoot.XML.Error.MessageState DOMAIN ('XML') PARSE (bitstream(InputBody),InputProperties.Encoding, InputProperties.CodedCharSetId)
statment however it still couldn't access it. Anyone have any ideas if it is even possible to access. This sample outputs an XML that i really don't need, however it has some useful parts like the exception description etc


I am trying to access the data in Error.Detail.MessageState
Error XML Output

Error
Error.MessageSource
Error.MessageSource.QueueManager='Error6_QM '
Error.MessageSource.Queue='IN4'
Error.Detail
Error.Detail.ExceptionType='ParserException'
Error.Detail.ErrorNumber='5374'
Error.Detail.SeverityLevel='3'
Error.Detail.ErrorSource=Dummy_Subflow.IN4'
Error.Detail.DiagnosticMessage='Exception whilst parsing. ImbRecoverableException caught from worker->parseNext.. An element has been deemed complete occuring less than specified minOccurs. '
Error.Detail.CauseOfError='28979^frontofficenumber. 0. 1. 1. '
Error.Detail.MessageState='<?xml version="1.0" encoding="UTF-8"?>..<!-- edited with tool v4.4 U (http://www.xmltool.com) by to-k (tool.com) -->..<dummy site="LON">...<Trade message="GBP"/>...</Trade>..</dummy>..'
Error.TimeStamp='2005-07-26 13:18:11.404'


-- This Variable determines whether Specific or General Diagnostic
-- Information is generated.

DECLARE v_MesageState CHAR;
DECLARE IsSpecific Boolean;
-- Can be dynamically set using the Environment Variable.
SET IsSpecific = True;
DECLARE I Integer;
DECLARE J Integer;
SET J = CARDINALITY("InputRoot".*[]);
SET I = 1;

-- Copying(Properties,MQMD,other headers) the Message Tree except for
-- the Body to the Output.
While I < J do
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
End While;

-- Sets the Output Diagnostic Message's Format to be XML.
SET "OutputRoot"."Properties"."MessageFormat" = 'XML';
SET OutputRoot.MQMD.Expiry = -1;

-- Source of the message, which caused the error.
SET OutputRoot.XML.Error.MessageSource.QueueManager =
"InputRoot".MQMD.ReplyToQMgr;
SET OutputRoot.XML.Error.MessageSource.Queue =
"InputRoot".MQMD.SourceQueue;

-- If isSpecific is True Specific Diagnostic Information is Generated.
If IsSpecific = True then
-- Point to the First Child to the ExceptionList Root.
DECLARE Location character;
DECLARE Diagnostics character;
DECLARE DiagnosticsInfo character;
DECLARE Width Integer;
SET Width = 1;
DECLARE Path REFERENCE TO InputExceptionList.*[Width];
-- Check whether the Width of the Exception Tree is more and Proceed.
While LastMove(Path) do
SET Diagnostics = '';
SET DiagnosticsInfo = '';
While FieldName(Path) = 'RecoverableException' or FieldName(Path) =
'DatabaseException' or
FieldName(Path) = 'ConversionException' or FieldName(Path) =
'ParserException' or FieldName(Path) = 'UserException'
do

IF Length(Path.Label) > 0 THEN
SET Location = Path.Label;
End if;
IF Length(Path.Text) > 0 THEN
SET Diagnostics = Diagnostics || Path.Text || '. ';
End if;
MOVE Path Lastchild;
End while;

-- Construct the Specific Diagnostic Message.
MOVE Path Parent;
-- Determine the source of message which caused the error.
SET OutputRoot.XML.Error.Detail[Width].ExceptionType = FieldName(Path);
SET OutputRoot.XML.Error.Detail[Width].ErrorNumber = Path.Number;
SET OutputRoot.XML.Error.Detail[Width].SeverityLevel = Path.Severity;
SET OutputRoot.XML.Error.Detail[Width].ErrorSource = Location;
SET OutputRoot.XML.Error.Detail[Width].DiagnosticMessage= Diagnostics;
MOVE Path FirstChild;

-- while loop included to generalize coding to ensure future
-- compatiblity in case of change in tree structure and to move
-- the insert's Field.
While FieldName(Path) <> 'Insert' do
MOVE Path NextSibling;
End while;

-- while loop to traverse all the inserts and construct the
-- additional diagnostic message.
While LastMove(Path) do
IF Length(Path.Text) > 0 THEN
SET DiagnosticsInfo = DiagnosticsInfo || Path.Text || '. ';
End if;
MOVE Path NextSibling;
End while;

SET OutputRoot.XML.Error.Detail[Width].CauseOfError = DiagnosticsInfo;
--SET OutputRoot.XML.Error.Detail[Width].MessageState =
-- cast(bitstream(InputBody) as CHAR ccsid 437);


SET OutputRoot.XML.Error.Detail[Width].MessageState = Cast(BITSTREAM(InputBody) as Char CCSID InputRoot.MQMD.CodedCharSetId);
SET v_MesageState = Cast(BITSTREAM(InputBody) as Char CCSID InputRoot.MQMD.CodedCharSetId);
SET Width = Width +1;
MOVE Path TO InputExceptionList.*[Width];
End while;
-- Else part to generate diagnostic message which has the structure
-- of all the trees as when the exception had occured
else
SET I = 1;
While I < J do
SET OutputRoot.XML.Error.*[I] = InputRoot.*[I];
SET I = I + 1;
End while;
SET OutputRoot.XML.Error.Environment = Environment;
SET OutputRoot.XML.Error.LocalEnvironment = InputLocalEnvironment;

SET OutputRoot.XML.Error.MessageState = cast(bitstream(InputBody) as CHAR ccsid 437);
--CREATE FIRSTCHILD of OutputRoot.XML.Error.Detail.MessageState DOMAIN ('XML') PARSE (bitstream(InputBody),InputProperties.Encoding, InputProperties.CodedCharSetId);
SET OutputRoot.XML.Error.ExceptionList = InputExceptionList;
End if;
SET OutputRoot.XML.Error.TimeStamp =
SUBSTRING(CAST(CURRENT_TIMESTAMP AS CHAR) FROM 12 FOR 23);
-- Flag set to Indicate Exception processing has occured in the flow.
SET Environment.Variables.ErrorFlag = 'Y';
Back to top
View user's profile Send private message
JT
PostPosted: Wed Jul 27, 2005 6:18 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Although the BITSTREAM function is still available, I believe it's been deprecated for quite some time now.

Try using the ASBITSTREAM function instead.
Back to top
View user's profile Send private message
goldym
PostPosted: Thu Jul 28, 2005 3:54 am    Post subject: Reply with quote

Centurion

Joined: 24 Jun 2005
Posts: 116

Thanks JT for responding. I changed it to abistream but it looked the same

The Output on the Exception queue looked the same. I guess my main problem is I need to populate my exception table with the data from my input XML. According to the info center you should be able to access the tree if you use a TryCatch node but I still cant' access it.

Do you know how I would access the data in Error.Detail.MessageState or better yet how I would access the original input? Below is a copy of the data parsed out. For example if I wanted to access dummy attr1 values?


Error
Error.MessageSource
Error.MessageSource.QueueManager='Error6_QM '
Error.MessageSource.Queue='IN4'
Error.Detail
Error.Detail.ExceptionType='ParserException'
Error.Detail.ErrorNumber='5374'
Error.Detail.SeverityLevel='3'
Error.Detail.ErrorSource='Subflow.IN4'
Error.Detail.DiagnosticMessage='Exception whilst parsing. ImbRecoverableException caught from worker->parseNext.. An element has been deemed complete occuring less than specified minOccurs. '
Error.Detail.CauseOfError='28878^SourceSystem. 0. 1. 28872^ProcessingInstruction. 1. '
Error.Detail.MessageState='<?xml version="1.0" encoding="UTF-8"?>..<!-- edited with tool(http://www.tool.com) -->..<dummy attr1="rates" attr2="20050307" attr3="47236" attr4="CHI" attr5="END">...<ProcessingInstruction/>...<Validation>....<TradeCount runid="47236" value="15013"/>...</Validation>..</dummy>..'
Error.TimeStamp='2005-07-28 07:43:08.228'
Back to top
View user's profile Send private message
kspranava
PostPosted: Mon Aug 01, 2005 10:49 pm    Post subject: connect to failure terminal of input node Reply with quote

Centurion

Joined: 27 Apr 2003
Posts: 124

Hi,

Try to catch the i/pdata and exception list from FAILURE terminal of input node and remove all TRYCATCH nodes. You will be able to get the desired output with whatever code u have.
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 » Accessing Original Input Message after Exception
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.