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 » Email with PDF Attachment

Post new topic  Reply to topic
 Email with PDF Attachment « View previous topic :: View next topic » 
Author Message
new_to_wmb8
PostPosted: Thu Jan 08, 2015 2:09 am    Post subject: Email with PDF Attachment Reply with quote

Centurion

Joined: 28 May 2013
Posts: 127
Location: Hyderabad, India

Hi Champs,

I have requirement to send the mails with the attachment using Email Output node.

I am successfully able to send the txt,html and other attachment but facing n using while sending the pdf or image file.

I am getting an xml message having one element contain 64 encoded data ..i have to send this data in an pdf attachment.

I am simply converting this encoded data to blob and sending to Email Output node but while opening the attachment it show invaid or corrupted data error.


SET attachment_Content = CAST(InputRoot.XMLNSC.ns:EmailMessage.ns:Content.ns:Attachment.ns:Content AS BLOB CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);

SET OutputLocalEnvironment.Destination.Email.Attachment.Content = attachment_ContentBlob;
i have also set the content encoding to base64 and content type to application/octet-stream.

Please provide any solution if anyone have.
Thanks
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jan 08, 2015 2:16 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Have you searched this forum for similar posts?

something like

Code:

email output pdf

Or
Code:

email output blob

_________________
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
View user's profile Send private message
new_to_wmb8
PostPosted: Thu Jan 08, 2015 2:28 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2013
Posts: 127
Location: Hyderabad, India

I had read the forum and followed the same steps as mentioned but didnot got the correct attachment
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jan 08, 2015 5:12 am    Post subject: Re: Email with PDF Attachment Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

new_to_wmb8 wrote:
i have also set the content encoding to base64 and content type to application/octet-stream.


Why that? Why not application/pdf?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
new_to_wmb8
PostPosted: Thu Jan 08, 2015 6:19 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2013
Posts: 127
Location: Hyderabad, India

I have tried with that one too but no result
Back to top
View user's profile Send private message
nelson
PostPosted: Thu Jan 08, 2015 6:36 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Not sure if this is the best way, but worked for me:

I receive the data in a

Code:
<xsd:element name="data" type="xsd:base64Binary"/>


Then cast this content to BLOB:

Code:
CAST(InputRoot.XMLNSC.ns:MyTag.ns:data AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);


Finally use this BLOB in a JCN:

Code:
byte[] Content = (byte[])MyMbElement.getValue();
attachment.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "Content", Content);


Maybe you don´t want to split the logic between a compute node and a JCN, so...

Hope this helps
Back to top
View user's profile Send private message
nelson
PostPosted: Thu Jan 08, 2015 6:42 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Forgot to mention:

Quote:
ContentType = 'application/octet-stream';
ContentEncoding = 'base64';
Back to top
View user's profile Send private message
new_to_wmb8
PostPosted: Thu Jan 08, 2015 7:07 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2013
Posts: 127
Location: Hyderabad, India

Hi,

I am doing the same thing in esql.


have decoded the incoming data and set the application/octet-stream and 64Bit but getting the error while try to open the pdf
Back to top
View user's profile Send private message
nelson
PostPosted: Thu Jan 08, 2015 7:57 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Are you sure the incoming data is correct? I remember having an issue with the base64 generated data. I'd check the base64 source data...
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 08, 2015 7:58 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Did you save the attachment from the sent email, and open it with a text editor?
Back to top
View user's profile Send private message
new_to_wmb8
PostPosted: Thu Jan 08, 2015 8:28 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2013
Posts: 127
Location: Hyderabad, India

Hi,

Finally its working.

Thanks to all...
Back to top
View user's profile Send private message
nelson
PostPosted: Thu Jan 08, 2015 8:33 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Hi, please share the solution
Back to top
View user's profile Send private message
new_to_wmb8
PostPosted: Thu Jan 08, 2015 9:24 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2013
Posts: 127
Location: Hyderabad, India

Hi,

In my scenario instead to go with JCN, i call the java procedure and decode the incoming encoded data into blob and pass that blob message in the content of the attachment
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 08, 2015 9:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So you didn't use the BASE64DECODE esql function?
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 » Email with PDF Attachment
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.