simonalexander2005
simonalexander2005

Reputation: 4577

Including the input message in the output message ESQL

Say I have an error handler subflow component in IIB that generates an error message, which is then output to a queue.

The error message is in a format similar to:

<ErrorMsg><Details>There was an error of some kind</Details><OriginalMsg></OriginalMsg></ErrorMsg>

The output from the MQInput Catch and Failure terminals points to the Input of the error handler. The message domain is set on the MQInput node for the main messageflow, and could be either XMLNSC or not specified.

Given this, if I wanted to include a copy of the original message in the error message, in the OriginalMsg tags (so it would need to be CData), how would I go about this?

I have tried something similar to the following (which a. requires XMLNSC anyway, and b. doesn't seem to work):

DECLARE InputMessageBlob BLOB ASBITSTREAM(inRef.XMLNSC, inRef.Properties.Encoding, inRef.Properties.CodedCharSetId);
DECLARE InputMessageChar CHAR CAST(InputMessageBlob AS CHAR CCSID 1208);
SET OutputRoot.XMLNSC.nm1:ErrorMsg.nm1:OriginalMsg.(XMLNSC.CDataField)nm1:Content = InputMessageChar;

The above allows me to deploy my bar files, but the output is just an empty tag.

Upvotes: 0

Views: 3676

Answers (2)

Rafael Manzoni
Rafael Manzoni

Reputation: 617

It´s probable that your inRef variable it´s not under a parser of XMLNSC. The IBM Integration Bus Parser only can transform the logical message into a phisycal message if it´s under a Domain parser representation.

To be sure you must ensure to use the message from InputRoot like in the example below:

DECLARE dataToBeParsed REFERENCE TO InputRoot.XMLNSC;
MOVE dataToBeParsed LASTCHILD;

DECLARE blobEnvelope BLOB ASBITSTREAM(dataToBeParsed
                                            ENCODING InputRoot.Properties.Encoding
                                            CCSID InputRoot.Properties.CodedCharSetId 
                                            SET '' 
                                            TYPE '' 
                                            FORMAT '' 
                                            OPTIONS FolderBitStream
                                            );

DECLARE envelope CHAR CAST(blobEnvelope AS CHAR CCSID InputRoot.Properties.CodedCharSetId);

Upvotes: 1

simonalexander2005
simonalexander2005

Reputation: 4577

The answer is to use InputBody:

DECLARE InputMessageBlob BLOB ASBITSTREAM(InputBody);
DECLARE InputMessageChar CHAR CAST(InputMessageBlob AS CHAR CCSID InputRoot.MQMD.CodedCharSetId);
SET OutputRoot.XMLNSC.nm1:ErrorMsg.nm1:OriginalMsg.(XMLNSC.CDataField)nm1:Content = InputMessageChar;

Upvotes: 0

Related Questions