Author |
Message
|
grasher134 |
Posted: Fri Aug 26, 2016 5:50 am Post subject: Problem with ccsid in emailOutput node with c# (Solved) |
|
|
Acolyte
Joined: 22 Oct 2014 Posts: 62
|
Hello,
I was using esql + emailOutput nodes to send email quite successful for a long time. Now I have a task to add an pdf attachment to it, so I had to parse a HTML string to pdf using c#.
I completed all of these tasks. I get an email with attachment, everything is great. The only problem left is ccsid of the main text. I need to send Russian symbols, and I get ???? instead. I had that problem previously in ESQL too, I solved it with
Code: |
SET OutputRoot.Properties.CodedCharSetId = '1208';
SET OutputRoot.Properties.Encoding = '546'; |
I did the same (I guess) thing in c#
Code: |
NBElement properties = outputRoot.FindOrCreate("Properties");
properties.FindOrCreate("CodedCharSetId").SetValue("1208");
properties.FindOrCreate("Encoding").SetValue("546"); |
I used the Trace node to find a difference between the messages I send in EmailOutput node
Here is the message from ESQL
Code: |
( ['WSRoot' : 0x32f76090]
(0x01000000:Name):Properties = ( ['MQPROPERTYPARSER' : 0x346e92c0]
(0x03000000:NameValue):MessageSet = '' (CHARACTER)
(0x03000000:NameValue):MessageType = '' (CHARACTER)
(0x03000000:NameValue):MessageFormat = '' (CHARACTER)
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 1208 (INTEGER)
(0x03000000:NameValue):Transactional = FALSE (BOOLEAN)
(0x03000000:NameValue):Persistence = FALSE (BOOLEAN)
(0x03000000:NameValue):CreationTime = GMTTIMESTAMP '2016-08-26 13:33:03.449' (GMTTIMESTAMP)
(0x03000000:NameValue):ExpirationTime = -1 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):ReplyIdentifier = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):ReplyProtocol = 'SOAP-HTTP' (CHARACTER)
(0x03000000:NameValue):Topic = NULL
(0x03000000:NameValue):ContentType = 'application/xml;charset=UTF-8' (CHARACTER)
(0x03000000:NameValue):IdentitySourceType = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceToken = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedType = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedToken = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
)
(0x01000000:Name):EmailOutputHeader = ( ['EMAILHDR' : 0x32f750f0]
(0x03000000:NameValue):From = 'mail@domain.az' (CHARACTER)
(0x03000000:NameValue):To = 'mail@domain.com' (CHARACTER)
(0x03000000:NameValue):Subject = 'tesdt' (CHARACTER)
)
(0x01000000:Name):BLOB = ( ['none' : 0x3a685b20]
(0x03000000:NameValue):BLOB = X'd182d0b5d181d18220d0b5d182d18120d182d0b5d0b0d18bd0b2d0bfd0b0d0b2d0bfd0b2d0b0' (BLOB)
)
)
|
And here is the message I get using c# (I commented the attachment part for now, as it is working fine)
Code: |
( ['WSRoot' : 0x29d05bf0]
(0x01000000:Name):Properties = ( ['WSPROPERTYPARSER' : 0x2938b120]
(0x03000000:NameValue):MessageSet = '' (CHARACTER)
(0x03000000:NameValue):MessageType = '' (CHARACTER)
(0x03000000:NameValue):MessageFormat = '' (CHARACTER)
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 1208 (INTEGER)
(0x03000000:NameValue):Transactional = FALSE (BOOLEAN)
(0x03000000:NameValue):Persistence = FALSE (BOOLEAN)
(0x03000000:NameValue):CreationTime = GMTTIMESTAMP '2016-08-26 13:28:02.711' (GMTTIMESTAMP)
(0x03000000:NameValue):ExpirationTime = -1 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):ReplyIdentifier = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):ReplyProtocol = 'SOAP-HTTP' (CHARACTER)
(0x03000000:NameValue):Topic = NULL
(0x03000000:NameValue):ContentType = 'application/xml;charset=UTF-8' (CHARACTER)
(0x03000000:NameValue):IdentitySourceType = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceToken = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedType = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedToken = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
)
(0x01000000:Name):EmailOutputHeader = ( ['EMAILHDR' : 0x29d01730]
(0x03000000:NameValue):From = 'mail@domain.az' (CHARACTER)
(0x03000000:NameValue):To = 'mail@domain.com' (CHARACTER)
(0x03000000:NameValue):Subject = 'tesdt' (CHARACTER)
)
(0x01000000:Name):BLOB = ( ['none' : 0x2206f5a0]
(0x03000000:NameValue):BLOB = X'd182d0b5d181d18220d0b5d182d18120d182d0b5d0b0d18bd0b2d0bfd0b0d0b2d0bfd0b2d0b0' (BLOB)
)
) |
The only difference I noticed is MQPROPERTYPARSER / WSPROPERTYPARSER.
I thought that the problem could be with EmailOutputHeader, so i rewrited it using parser. But didn't help.
Code: |
NBElement emailOutputHeader = outputRoot.CreateLastChildUsingNewParser(NBParsers.NBHeaderParsers.EmailOutputHeader.ParserName); |
Using 9.0.0.5 on Windows, obviously.
EDIT: I parse the text to BLOB using Encoding.UTF8
Code: |
outputRoot.CreateLastChildUsingNewParser("BLOB").CreateLastChild("BLOB").SetValue(Encoding.UTF8.GetBytes(inputrootEmail["Text"].GetString())); |
Last edited by grasher134 on Tue Aug 30, 2016 4:53 am; edited 1 time in total |
|
Back to top |
|
 |
grasher134 |
Posted: Mon Aug 29, 2016 9:12 pm Post subject: |
|
|
Acolyte
Joined: 22 Oct 2014 Posts: 62
|
So I'm the only idiot who tried to send emails using c# ?  |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Aug 30, 2016 3:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Maybe you're the only smart engineer who's tried to do this.. Or maybe it's simply that the people here haven't tried to do this.
The difference between the MQPROPERTYPARSER and the WSPROPERTYPARSER should simply be a matter of where you got the message that comes into the .NET node. and I'm surprised that it's causing any issues.
Since you're making some kind of HTTP call, that's very likely where the difference comes from.
I'd suggest a user trace. It may help. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
grasher134 |
Posted: Tue Aug 30, 2016 4:51 am Post subject: |
|
|
Acolyte
Joined: 22 Oct 2014 Posts: 62
|
This was the root of evil:
Code: |
NBElement outputLocalEnvironment = outAssembly.LocalEnvironment.RootElement; outputLocalEnvironment.CreateLastChild("Destination").CreateLastChild("Email").CreateLastChild("BodyContentType").SetValue("text/html; charset=utf-8");
|
And I changed the way I created Properties and EmailOutpuHeader trees to
Code: |
NBElement emailOutputHeader = outputRoot.CreateLastChildUsingNewParser(NBParsers.NBHeaderParsers.EmailOutputHeader.ParserName);
|
P.S. User trace doesn't show you the processing in DotNet nodes. That is all the text you'll get
Code: |
2016-08-30 10:03:14.963884 12644 UserTrace BIP7472W: Running the Evaluate method of the .NETCompute node ''.NETCompute'' from the assembly ''composeEmailIB'' in the AppDomain ''SendEmail''.
Passing a message to the Evaluate method of the specified node. |
Last edited by grasher134 on Tue Aug 30, 2016 5:04 am; edited 1 time in total |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Aug 30, 2016 5:02 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
grasher134 |
Posted: Tue Aug 30, 2016 5:07 am Post subject: |
|
|
Acolyte
Joined: 22 Oct 2014 Posts: 62
|
Thank you again, I will look into it.
My mistake was that I was logging only InputRoot in trace node. And the problem was in the Local Environment. |
|
Back to top |
|
 |
timber |
Posted: Tue Aug 30, 2016 5:08 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
User trace doesn't show you the processing in DotNet nodes. That is all the text you'll get |
you should be able to attach your c# debugger to DataFlowEngine.exe and hook into your own code when it gets executed. |
|
Back to top |
|
 |
|