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 » Another CCSID problem

Post new topic  Reply to topic
 Another CCSID problem « View previous topic :: View next topic » 
Author Message
shubham_057
PostPosted: Mon Mar 31, 2014 6:52 am    Post subject: Reply with quote

Novice

Joined: 24 Mar 2014
Posts: 14

Hi sam,

Please refer to post http://www.mqseries.net/phpBB2/viewtopic.php?p=218326#218326

I'm also facing the same issue, the sending and receiving applications are on different OS and one of the flows receiving message is writing the messages to an Oracle database.
But the problem is the message is falling into backout queue instead of getting audited into d/b.
I have checked the CCSID of both queue managers, both are same.

Can you please tell me what changes have you done in the db scripts.
I'm posting the logs and code for reference.
Broker logs:
Code:

(UKS06.ACIF_001)[35]BIP2230E: Error detected whilst processing a message in node 'ACIF_AUDIT_1_5.Insert audit record'.

(UKS06.ACIF_001)[35]BIP2488E:  (.ACIF_AUDIT_1_5_Insert audit record.main, 16.1) Error detected whilst executing the SQL statement 'DECLARE refAONDataRoot REFERENCE TO InputBody.MSG;'.

(UKS06.ACIF_001)[35]BIP2498E: (.ACIF_AUDIT_1_5_Insert audit record.main, 16.39) : An error occurred when navigating to path element '2' of the field reference at the given location.

UKS06.ACIF_001)[35]BIP5009E: XML Parsing Errors have occurred.

(UKS06.ACIF_001)[35]BIP5004E: An XML parsing error 'Invalid character (Unicode: 0x2) ' occurred on line 1 column 441 when parsing element 'app_data'.  Internal error codes are '196' and ''.

(UKS06.ACIF_001)[35]BIP2628E: Exception condition detected on input node 'ACIF_AUDIT_1_5.ACIF_AUDIT_01'.

(UKS06.ACIF_001)[35]BIP2230E: Error detected whilst processing a message in node 'ACIF_AUDIT_1_5.ACIF_ERROR_01'.

(UKS06.ACIF_001)[35]BIP5010E: XML Writing Errors have occurred.

[i]I don't understand this one[/i]

(UKS06.ACIF_001)[35]BIP5005E: There are 2 top level elements 'msg,MSG' in the document.

(UKS06.CONCERT_001)[7]BIP2648E: Message backed out to a queue; node 'ACIF_AUDIT_1_5.ACIF_AUDIT_01'.




Here is the code i'm using for writing the input message into the d/b

Code:


CREATE COMPUTE MODULE "WriteNonXMLToAudit_1_0_WriteNonXMLToAudit"
   CREATE FUNCTION main() RETURNS BOOLEAN BEGIN
      SET OutputRoot = InputRoot;
      
      DECLARE ver CHAR;
      DECLARE codeName CHAR;

      SET ver = '1_0_2';
      SET codeName = 'WriteNonXMLToAudit.' || 'Version:' || ver;

      DECLARE aonMSG REFERENCE To "OutputRoot"."BLOB";
      DECLARE appError REFERENCE To InputExceptionList;
      /* msid and messageType will not be available */
      DECLARE msid INTEGER;
      DECLARE messageType CHAR;
      DECLARE sourceApplication CHAR;   
      DECLARE mqHdrBlob BLOB;
      DECLARE mqHdrChar CHAR;
      DECLARE msgBlob BLOB;
      DECLARE msgChar CHAR;
      DECLARE msgUUID CHAR;
      

      SET OutputRoot.MQMD.Format = 'MQSTR   ';
      SET OutputRoot.MQMD.CodedCharSetId = 819;
      SET OutputRoot.MQMD.Encoding = 273;
      SET OutputRoot."MQRFH2" = NULL;

      MOVE aonMSG TO "OutputRoot"."BLOB";

      SET msgChar = aonMSG;

      SET messageType = 'NON_STANDARD_MESSAGE';
      SET msid = 9998;
      
      SET msgUUID = UUIDASCHAR;
      SET sourceApplication = RTRIM(OutputRoot.MQMD.PutApplName);
      
      SET msgChar = CAST(OutputRoot."BLOB"."BLOB" As CHAR CCSID 819 ENCODING OutputRoot.MQMD.Encoding );

      Insert Into Database.Message_Audit (UUID, MSID, Message_Type, Source_Application, Message_Body)
      Values ( SUBSTRING(msgUUID FROM 1 FOR 35),
      msid,
      SUBSTRING(messageType FROM 1 FOR 29),
      SUBSTRING(sourceApplication FROM (LENGTH(sourceApplication) - 9) FOR 10),
      msgChar);

      IF SQLCODE <> 0 THEN
         RETURN FALSE;
      END IF;

      RETURN TRUE;

   END;

END MODULE;


Here is code for message flow ACIF AUDIT 1_5 :
Code:

CREATE COMPUTE MODULE "ACIF_AUDIT_1_5_Insert exception into msg"
CREATE FUNCTION main() RETURNS BOOLEAN BEGIN
SET OutputRoot = InputRoot;
CREATE FIRSTCHILD OF OutputRoot.XML.MSG.APP_DATA Name 'APP_ERROR';
CREATE LASTCHILD OF OutputRoot.XML.MSG.APP_DATA.APP_ERROR Name 'ERROR_SOURCE' VALUE 'ACIFBROKER';
CREATE LASTCHILD OF OutputRoot.XML.MSG.APP_DATA.APP_ERROR Name 'ERROR_OPERATION' VALUE 'ACIF_AUDIT_Exception';
CREATE LASTCHILD OF OutputRoot.XML.MSG.APP_DATA.APP_ERROR Name 'ERROR_CODE' VALUE '';
CREATE LASTCHILD OF OutputRoot.XML.MSG.APP_DATA.APP_ERROR Name 'ERROR_STRING';
Set OutputRoot.XML.MSG.APP_DATA.APP_ERROR.ERROR_STRING = InputExceptionList;
CREATE LASTCHILD OF OutputRoot.XML.MSG.APP_DATA.APP_ERROR Name 'ERROR_DETAIL' VALUE 'Exception List';
SET OutputRoot."MQRFH2" = NULL;
SET OutputRoot.MQMD.CodedCharSetId = MQCCSI_INHERIT;  /*819*/
SET OutputRoot.MQMD.Encoding = MQENC_NATIVE;         /*273*/
Set OutputRoot.MQMD.Format = 'MQSTR';

RETURN true;
END;

END MODULE;
CREATE COMPUTE MODULE "ACIF_AUDIT_1_5_Insert audit record"
CREATE FUNCTION main() RETURNS BOOLEAN BEGIN
SET OutputRoot = InputRoot;

Declare refAONDataRoot       REFERENCE To InputBody.MSG;
Declare refSOAPDataRoot      REFERENCE TO InputBody."SOAP-ENV:Envelope";
Declare MSGChar       CHAR;
Declare MSGBlob       BLOB;
DECLARE intSQLCode      INTEGER;
DECLARE chrSQLErrorText      CHAR;
DECLARE uuid      CHAR;
DECLARE msid      INT;
DECLARE mType      CHAR;
DECLARE srcApp      CHAR;
Declare msgRef       REFERENCE TO InputBody;

If FIELDNAME(refAONDataRoot.AONHEADER) = 'AONHEADER' Then
      Set MSGBlob = BITSTREAM(refAONDataRoot);
   Set MSGChar  = CAST(MSGBlob As CHAR CCSID InputRoot.MQMD.CodedCharSetId);
   Set msid = refAONDataRoot.AONHEADER.MSID;
   
   IF  refAONDataRoot.APP_DATA.APP_HEADER.UUID IS NOT NULL THEN
      SET uuid = refAONDataRoot.APP_DATA.APP_HEADER.UUID;
   ELSE      
      IF  FIELDNAME(refAONDataRoot.APP_DATA.AON_APPLICATION_MESSAGE.HEADER.MESSAGE_ID ) IS NOT NULL THEN
         SET uuid = refAONDataRoot.APP_DATA.AON_APPLICATION_MESSAGE.HEADER.MESSAGE_ID;
         SET msid = 9999;
      END IF;
   END IF;
   IF  FIELDNAME(refAONDataRoot.APP_DATA.APP_HEADER.MESSAGE_TYPE) IS NOT NULL THEN
      SET mType = refAONDataRoot.APP_DATA.APP_HEADER.MESSAGE_TYPE;
   ELSE
      IF  FIELDNAME(refAONDataRoot.APP_DATA.AON_APPLICATION_MESSAGE.HEADER.MESSAGE_TYPE ) IS NOT NULL THEN
         SET mType = refAONDataRoot.APP_DATA.AON_APPLICATION_MESSAGE.HEADER.MESSAGE_TYPE;
      END IF;
   END IF;
   
   Insert Into Database.MESSAGE_AUDIT (UUID,MSID,MESSAGE_TYPE,SOURCE_APPLICATION,MQ_HEADER,MESSAGE_BODY)
   Values (uuid,msid,mType,refAONDataRoot.AONHEADER.APPLICATION_NAME,'',MSGChar);   
   
ElseIf FIELDNAME(refSOAPDataRoot."SOAP-ENV:Header") = 'SOAP-ENV:Header' Then

   Set MSGBlob = BITSTREAM(refSOAPDataRoot);
   Set MSGChar  = CAST(MSGBlob As CHAR CCSID InputRoot.MQMD.CodedCharSetId);

   Insert Into Database.MQUSER.MESSAGE_AUDIT (UUID,MSID,MESSAGE_TYPE,SOURCE_APPLICATION,MQ_HEADER,MESSAGE_BODY)
   Values (refSOAPDataRoot."SOAP-ENV:Header".MessageHeader.uuid,'',refSOAPDataRoot."SOAP-ENV:Header".MessageHeader.messageType,'','',MSGChar);
      
ElseIf FIELDNAME(InputBody.AON_APPLICATION_MESSAGE) IS NOT NULL Then
   
   MOVE msgRef TO InputBody.AON_APPLICATION_MESSAGE;
   Set MSGBlob = BITSTREAM(msgRef);
   Set MSGChar = CAST(MSGBlob As CHAR CCSID InputRoot.MQMD.CodedCharSetId);

   Set msid = '9999';
   Set mType = 'Unset';
   Set srcApp = 'Unset';
   
   IF FIELDNAME(msgRef.HEADER.MESSAGE_ID) IS NOT NULL THEN
      SET uuid = msgRef.HEADER.MESSAGE_ID;
   END IF;
   
   IF FIELDNAME(msgRef.HEADER.MSID) IS NOT NULL THEN
      SET msid = CAST(msgRef.HEADER.MSID AS INT);
   END IF;
   
   IF FIELDNAME(msgRef.HEADER.MESSAGE_TYPE) IS NOT NULL THEN
      SET mType = msgRef.HEADER.MESSAGE_TYPE;
   END IF;
   
   IF FIELDNAME(msgRef.HEADER.SENDER) IS NOT NULL THEN
      SET srcApp = msgRef.HEADER.SENDER;
   END IF;
   
   Insert Into Database.MESSAGE_AUDIT (UUID,MSID,MESSAGE_TYPE,SOURCE_APPLICATION,MQ_HEADER,MESSAGE_BODY)
   Values (uuid,msid,mType,srcApp,'',MSGChar);
ElseIf FIELDNAME(InputBody.msg.header.application_name) IS NOT NULL Then
   
   MOVE msgRef TO InputBody.msg;
   Set MSGBlob = BITSTREAM(msgRef);
   Set MSGChar = CAST(MSGBlob As CHAR CCSID InputRoot.MQMD.CodedCharSetId);

   Set srcApp = msgRef.header.application_name;

   IF FIELDNAME(msgRef.header.msid) IS NOT NULL Then
      Set msid = msgRef.header.msid;
   ELSE
      Set msid = '9997';
   END IF;
   
   Set mType = 'Unset:ATLAS_MESSAGE';
   Set uuid = UUIDASCHAR;
   
   Insert Into Database.MESSAGE_AUDIT (UUID,MSID,MESSAGE_TYPE,SOURCE_APPLICATION,MQ_HEADER,MESSAGE_BODY)
   Values (uuid,msid,mType,srcApp,'',MSGChar);   
      
Else

   RETURN TRUE;
End If;

RETURN FALSE;

END;

END MODULE;
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 31, 2014 7:45 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Imagine the BLOB is text... The casting from input to output CCSID is not done right! Google the site. I'm sure you'll find multiple examples...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Apr 01, 2014 4:12 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

This is the first error:
Quote:
UKS06.ACIF_001)[35]BIP5009E: XML Parsing Errors have occurred. (UKS06.ACIF_001)[35]BIP5004E: An XML parsing error 'Invalid character (Unicode: 0x2) ' occurred on line 1 column 441 when parsing element 'app_data'. Internal error codes are '196' and ''.
This error is normally caused by telling the XML parser that the document is in CCSID X when it is really in CCSID Y. You need to figure out why this is happening for yourself.

The second error message is:
Quote:
(UKS06.ACIF_001)[35]BIP5010E: XML Writing Errors have occurred.
There are 2 top level elements 'msg,MSG' in the document
This might be caused by the first error ( although I would ask some hard questions about the error handling in the message flow if so ). Or it might be a completely separate problem. Either way, the problem is that the message tree contains two root elements, so it is impossible to write a well-formed XML document based on the message tree.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
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 » Another CCSID problem
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.