|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Attachment on EmailOutput --- WMB 7 |
« View previous topic :: View next topic » |
Author |
Message
|
scravr |
Posted: Fri Mar 19, 2010 9:45 am Post subject: Attachment on EmailOutput --- WMB 7 |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
How can I get $ExceptionList as Attachment on EmailOutput node?
I have on EmailOutput node:
Attachment ContentType as text/plain
ContentEncoding as Quoted-printable
MultiPartContentType as related
I am testing with IH03 on windows puting a meeage to a broker on UNIX SUN box.
Broker sends an email from UNIX to windows via SMTP server.
Email recieved on microsoft outlook has subject and body with expected data, and attachment file with 224 bytes.
But when open with notepad its looks empty.
Any ideas how to pass Attachment?
Do I need to mess with building ESQL or JAVA? |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Mar 19, 2010 11:32 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
IN versions prior to V7, I would zip up both the original message (in unparsed BLOB format) plus the exceptionlist into a single .zip attachment,.
This does work.
So far, the zip node plugin tooklit part does not work on V7. I sent an email to the maintainer but never got a reply.
I'm looking at some other solution probably using a UDN with some Java underneath _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Mar 19, 2010 1:09 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There is no parser to serialize ExceptionList into a bitstream.
You have to do that yourself.
This doesn't have a lot to do with "zip files" of any sort, that I can see, unless the zip file plugin does serialization of ExceptionList for you. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Mar 19, 2010 2:11 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mqjeff wrote: |
There is no parser to serialize ExceptionList into a bitstream.
You have to do that yourself.
This doesn't have a lot to do with "zip files" of any sort, that I can see, unless the zip file plugin does serialization of ExceptionList for you. |
I'd have to look at the code to see what I did to put it all together.
What I was aiming at was to give 'support' an attachment that would contain everything they needed to investigate the problem. 1) the exceptionlist, 2) the original unparesed message
IMHO, the best way of sending this through email was to zip it up into a single container.
I was using this as an example of sending the exceptionlist as an email attachment in such a way that it won't get mangled by email or other systems when it is sent or opened in a normal email client. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Mar 25, 2010 1:44 pm Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
I had the same problem some time ago. I have written a tree-walker which goes through the tree (that I am interested in, in this case the exception-tree) and flattens out the contents to lines. The lines can then be passed over to the eMail-Node.
This is not an attachment, but it is "within" the body of the eMail. You can contact me directly for further support. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Mar 26, 2010 5:19 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Why not post your source code for an example that people can learn from? This sounds like a utility that many people could use.
 |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Mar 26, 2010 6:15 am Post subject: xmlTree2eMailLines() |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
This code is written for the support pack IA07 (Send mail node)
Code: |
CREATE PROCEDURE msgTree2EMailLines (IN root REFERENCE, IN rOutputRoot REFERENCE, IN depth INT)
BEGIN
DECLARE cursor REFERENCE TO root;
DECLARE lineIndex INT CARDINALITY( rOutputRoot.XML.Message.Body.Line[] ) + 1;
IF lineIndex < 1000 THEN
IF CARDINALITY (cursor.*[]) = 0 THEN -- IF the Element has no children, then it is a leaf
DECLARE whiteSpace CHAR REPLICATE( ' ', depth );
DECLARE fieldName1 CHAR FIELDNAME( cursor );
DECLARE fieldValue1 CHAR coalesce( cursor, '');
IF fieldName1 <> '' THEN
CALL insertEMailLine( rOutputRoot, whiteSpace || fieldName1 || ' = ' || fieldValue1 );
SET lineIndex = lineIndex + 1;
ELSE
CALL insertEMailLine( rOutputRoot, 'TEST' || rOutputRoot.XML.Message.Body.Line[lineIndex] || ' = ' || fieldValue1 );
END IF;
ELSE -- If has children then loop through the children, then it is a node in the tree
DECLARE whiteSpace CHAR REPLICATE( ' ', depth );
DECLARE fieldName1 CHAR FIELDNAME( cursor );
DECLARE fieldValue1 CHAR coalesce( cursor, '*NULL*');
IF fieldValue1 = '*NULL*' THEN
CALL insertEMailLine( rOutputRoot, whiteSpace || fieldName1 );
SET lineIndex = lineIndex + 1;
ELSE
CALL insertEMailLine( rOutputRoot, whiteSpace || fieldName1 || ' = ' || fieldValue1 );
SET lineIndex = lineIndex + 1;
END IF;
MOVE cursor FIRSTCHILD;
WHILE LASTMOVE(cursor) DO
CALL msgTree2EMailLines(cursor, rOutputRoot, depth + 1);
MOVE cursor NEXTSIBLING;
END WHILE;
END IF;
ELSE
IF rOutputRoot.XML.Message.Body.Line[lineIndex - 1] <> '-------Message too long-------' THEN
SET rOutputRoot.XML.Message.Body.Line[lineIndex] = '-------Message too long-------';
END IF;
END IF;
END;
CREATE PROCEDURE insertEMailLine (IN rOutputRoot REFERENCE, IN text CHAR)
BEGIN
DECLARE lineIndex INT CARDINALITY( rOutputRoot.XML.Message.Body.Line[] ) + 1;
IF lineIndex < 5001 THEN
IF LENGTH( text ) > 1000 THEN -- Trim eMail-lines which are too long
SET text = SUBSTRING( text FROM 1 FOR 1000) || '[...]';
END IF;
SET rOutputRoot.XML.Message.Body.Line[lineIndex] = text;
ELSEIF lineIndex = 5001 THEN -- eMail has enough email-lines
SET rOutputRoot.XML.Message.Body.Line[ 5000 ] = '-------eMail too long-------';
ELSE
CALL throw( '"lineIndex" CANNOT BE greater than 5001, but it is "' || CAST( lineIndex AS CHAR ) || '"!' );
END IF;
END;
CREATE PROCEDURE insertException ( IN exceptionRef REFERENCE, IN outputRoot REFERENCE )
-- Creates custom Error Messages or returns a generic one
-- Use REPLACE('Error on Port $1, Server $2', CAST( 1234 AS CHAR ), '123.45.67.89' ) to create proper ErrorMsgs
BEGIN
DECLARE exceptionType CHAR;
-- Parse the Exception for the last Error
WHILE( FIELDNAME(exceptionRef.*[<]) = 'RecoverableException' or
FIELDNAME(exceptionRef.*[<]) = 'ParserException' or
FIELDNAME(exceptionRef.*[<]) = 'DatabaseException' or
FIELDNAME(exceptionRef.*[<]) = 'UserException' or
FIELDNAME(exceptionRef.*[<]) = 'ConvertionException' )
DO
SET exceptionType = FIELDNAME( exceptionRef.*[<] );
MOVE exceptionRef TO exceptionRef.*[<];
END WHILE;
DECLARE exceptionNumber INT exceptionRef.Number;
IF exceptionType = 'ParserException' THEN
IF exceptionNumber IN ( 5304 ) THEN -- RM Dictionary not Found.
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.Text, '- Text is null -' ) || ' (' || coalesce( exceptionRef.Insert[3].Text, '- Text is null -' ) || ')' );
ELSE
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
END IF;
ELSEIF exceptionType = 'DatabaseException' THEN
IF exceptionNumber = 2322 THEN -- Unique Constraint violated
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
ELSE
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
END IF;
ELSEIF exceptionType = 'UserException' THEN
IF exceptionNumber = 3012 THEN -- User generated Exception
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
ELSE
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
END IF;
ELSEIF exceptionType = 'ConvertionException' THEN
-- IF exceptionNumber = THEN
-- CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
-- ELSE
CALL insertEMailLine( outputRoot, coalesce( exceptionRef.*[<].Text, '- Text is null -' ) );
-- END IF;
ELSE
CALL msgTree2EMailLines( exceptionRef, outputRoot, 0 );
END IF;
END;
CREATE PROCEDURE throw(IN exceptionText CHAR) -- Throws an exception
BEGIN
THROW USER EXCEPTION Message 3012 VALUES( exceptionText );
END; |
_________________ Just use REFERENCEs |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|