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 » Not able to Read PDF file sent from EmailOutput Node

Post new topic  Reply to topic Goto page 1, 2  Next
 Not able to Read PDF file sent from EmailOutput Node « View previous topic :: View next topic » 
Author Message
Vinnie
PostPosted: Mon Mar 05, 2012 4:08 am    Post subject: Not able to Read PDF file sent from EmailOutput Node Reply with quote

Newbie

Joined: 05 Mar 2012
Posts: 3

Hi

I am trying to send a mail with attachment (PDF as attachment) using EmailOutput node in WMB 7.0.0.3. The mail is sent and the PDF is attached in the mail. But the PDF is not opening and giving error as ' Adobe Reader could not open this file type because it is either not a supported file type..."

The email settings used in email output node are as under :

SET OutputLocalEnvironment.Destination.Email.Attachment.ContentName = Environment.SaveData.AttachmentName;
( here the attachment name is Jan2012Newsletter1.pdf )

SET OutputLocalEnvironment.Destination.Email.Attachment.ContentType = Environment.SaveData.AttachmentContentType;
( here the attachment content type is PDF. I have tried using text/plain or text/html or text/xml or application/octet-stream)


SET OutputLocalEnvironment.Destination.Email.Attachment.Content = CAST(Environment.SaveData.Attachment AS BLOB CCSID 1208);

Here Attachement is the text in pdf say 'hi'

and the attachment content encoding is set as Base 64 on the email output node

But the PDF file received in email is not opening.

Please suggest.
Back to top
View user's profile Send private message Send e-mail
mqsiuser
PostPosted: Mon Mar 05, 2012 4:16 am    Post subject: Re: Not able to Read PDF file sent from EmailOutput Node Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Open and look at the (generated) eMail in a Texteditor and read more about MIME (e.g. the RFCs)

Try to identify what happens and what goes wrong in the texteditor.

Also: Instead of sending just for testing put the message on a queue and look at it's content (to figure out what is happening).

Use a "professional" TextEditor e.g. Ultraedit or notepad++
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
murdeep
PostPosted: Thu Mar 08, 2012 4:55 pm    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

I think I have a similar problem. Running WMB V6.1.0.9.

Using the sample MIME code from the V7 doc (http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac66350_.htm)

I've modded it to look like:

Code:
     -- First part:
     --   Create the body of the email.
     --   The body of the email has the text 'This is the main body of the email.'.
     CREATE FIELD P1."Content-Type" TYPE NameValue VALUE 'text/plain; charset=us-ascii';
     CREATE FIELD P1."Content-Transfer-Encoding" TYPE NameValue VALUE '8bit';
     CREATE LASTCHILD OF P1 TYPE Name NAME 'Data';
     CREATE LASTCHILD OF P1.Data DOMAIN('BLOB') PARSE(CAST('This is the main body of the email.' AS BLOB CCSID 1208));
    
     CREATE LASTCHILD OF M.Parts TYPE Name NAME 'Part';
     DECLARE P2 REFERENCE TO M.Parts.Part[2];

     -- Second part:
     --   Create the attachment of an email.
    
     CREATE FIELD P2."Content-Type" TYPE NameValue VALUE 'application/octet-stream; name=attachment.pdf';
     CREATE FIELD P2."Content-Transfer-Encoding" TYPE NameValue VALUE 'binary';
     CREATE LASTCHILD OF P2 TYPE Name NAME 'Data';
     CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(InputRoot.BLOB.BLOB);    


I use rfhutil to open the pdf and put it to my flow input queue. MQMD.Format is set to MQFMT_NONE and the flow input queue parser is set to BLOB.

Now when I send this to my smtp server I get the email with the attachment but the pdf is corrupt.

I use a hex editor to compare the pdf before sending it to what I receive and I notice that all my 0A's <LF> are now 0D0A's <CR><LF>.

Can anyone enlighten me what I need to do to prevent this from occuring?

Thanks in advance.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Thu Mar 08, 2012 5:49 pm    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

The eMail Output node is "relativly new". Also it has quite some changes in it compared to its pre-decessor, the send mail plug-in.

I think it can be a bug and that you might have traced the cause down very well.

The cause is Unix to Windows encoding conversion: You should check whether you do it right (set the codepage)... but I think you are not doing it wrong!

I think this will be a PMR: Doing char-conversion/recoding (doubling) within the base64...
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Mar 08, 2012 6:46 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

This line looks like your problem:

Code:
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(InputRoot.BLOB.BLOB);


Because your input data already is a BLOB, you are re-encoding it as a BLOB again by using the PARSE clause. Try something like this instead (not tested):

Code:
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB');
CREATE LASTCHILD OF P2.Data.BLOB NAME 'BLOB' VALUE InputRoot.BLOB.BLOB;


Kind Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
murdeep
PostPosted: Thu Mar 08, 2012 7:15 pm    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

mgk wrote:
This line looks like your problem:

Code:
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(InputRoot.BLOB.BLOB);


Because your input data already is a BLOB, you are re-encoding it as a BLOB again by using the PARSE clause. Try something like this instead (not tested):

Code:
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB');
CREATE LASTCHILD OF P2.Data.BLOB NAME 'BLOB' VALUE InputRoot.BLOB.BLOB;


Kind Regards,


Ok, I will try this. Why would this make all <LF> become <CRLF> though?
Back to top
View user's profile Send private message
Vinnie
PostPosted: Thu Mar 08, 2012 9:48 pm    Post subject: Issue Resolved. Reply with quote

Newbie

Joined: 05 Mar 2012
Posts: 3

The issue has been resolved.

In the input text file..we have to give the PDF attachment content in base -64 format. and then in the code we have to decode the content using decode method from java.

SET OutputLocalEnvironment.Destination.Email.Attachment.Content = base64Decode(Environment.SaveData.Attachment);

here base64Decode is the procedure

CREATE PROCEDURE base64Decode(IN source CHAR)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.javacompute.Base64.decode";

By following the above steps, I have sent mail with PDF attachment and the attachment is opening in the desired format.


Now the next concern is to send a PPT attachment. I ahve followed the same above procedure and its not working.

Any suggestions?
Back to top
View user's profile Send private message Send e-mail
mqsiuser
PostPosted: Thu Mar 08, 2012 11:18 pm    Post subject: Re: Issue Resolved. Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Vinnie wrote:
Now the next concern is to send a PPT attachment. I ahve followed the same above procedure and its not working.

Try for at least a couple of days. If you cant get it to work ask (here) again.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
murdeep
PostPosted: Fri Mar 09, 2012 7:03 am    Post subject: Re: Issue Resolved. Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

Vinnie wrote:
The issue has been resolved.

In the input text file..we have to give the PDF attachment content in base -64 format. and then in the code we have to decode the content using decode method from java.

SET OutputLocalEnvironment.Destination.Email.Attachment.Content = base64Decode(Environment.SaveData.Attachment);

here base64Decode is the procedure

CREATE PROCEDURE base64Decode(IN source CHAR)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.javacompute.Base64.decode";

By following the above steps, I have sent mail with PDF attachment and the attachment is opening in the desired format.


Now the next concern is to send a PPT attachment. I ahve followed the same above procedure and its not working.

Any suggestions?


Ok just so I understand are you saying that the pdf is base64 encoded before it is put on the queue and then your flow decodes it before attaching it? Also, under what version of WMB are you running? Thanks
Back to top
View user's profile Send private message
murdeep
PostPosted: Fri Mar 09, 2012 8:17 am    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

mgk wrote:

Code:
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB');
CREATE LASTCHILD OF P2.Data.BLOB NAME 'BLOB' VALUE InputRoot.BLOB.BLOB;


Kind Regards,


Ok, I tried this change and the attachment I received is the same. It is definately messing up <LF> and <CR>. Other than that it appears as though the doc is fine.
Back to top
View user's profile Send private message
murdeep
PostPosted: Fri Mar 09, 2012 9:01 am    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

Ok, clueing into to what Vinnie posted I base64 encoded my pdf and put that to my flow input queue. I then changed the flow esql to look like:

Code:
     -- First part:
     --   Create the body of the email.
     --   The body of the email has the text 'This is the main body of the email.'.
     CREATE FIELD P1."Content-Type" TYPE NameValue VALUE 'text/plain; charset=us-ascii';
     CREATE FIELD P1."Content-Transfer-Encoding" TYPE NameValue VALUE '8bit';
     CREATE LASTCHILD OF P1 TYPE Name NAME 'Data';
     CREATE LASTCHILD OF P1.Data DOMAIN('BLOB') PARSE(CAST('This is the main body of the email.' AS BLOB CCSID 1208));
    
     CREATE LASTCHILD OF M.Parts TYPE Name NAME 'Part';
     DECLARE P2 REFERENCE TO M.Parts.Part[2];

     -- Second part:
     --   Create the attachment of an email.
     CREATE FIELD P2."Content-Type" TYPE NameValue VALUE 'application/octet-stream; name=attachment.pdf';
     CREATE FIELD P2."Content-Transfer-Encoding" TYPE NameValue VALUE 'base64';
     CREATE LASTCHILD OF P2 TYPE Name NAME 'Data';
     CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(InputRoot.BLOB.BLOB);


and when I received the attachment as an email it was valid. So the requirement is to ensure the pdf is base64 encoded before sending it with a Content-Transfer-Encoding of base64.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 09, 2012 9:42 am    Post subject: Reply with quote

Grand High Poobah

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

murdeep wrote:
So the requirement is to ensure the pdf is base64 encoded before sending it with a Content-Transfer-Encoding of base64.


It's always a good idea to base64 encode something which is described as base64 encoded.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
murdeep
PostPosted: Fri Mar 09, 2012 9:59 am    Post subject: Reply with quote

Master

Joined: 03 Nov 2004
Posts: 211

Vitor wrote:
murdeep wrote:
So the requirement is to ensure the pdf is base64 encoded before sending it with a Content-Transfer-Encoding of base64.


It's always a good idea to base64 encode something which is described as base64 encoded.


If you read the earlier posts you would see that the Content-Transfer-Encoding was not base64 but was binary. If you can't post something that is helpful then maybe you should consider not posting at all.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 09, 2012 10:03 am    Post subject: Reply with quote

Grand High Poobah

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

murdeep wrote:
If you can't post something that is helpful then maybe you should consider not posting at all.


If I only posted helpful things, 99% of my posts and 100% of my fun would disappear.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 09, 2012 10:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

murdeep wrote:
If you can't post something that is helpful then maybe you should consider not posting at all.


There's a lot of room to call something helpful without it providing any assistance to anyone other than the poster.

There's a lot of room to call something helpful that does not provide a direct and immediate and instantaneous answer to the direct question being asked.

In other words, the word 'helpful' is not as clear as you think it is.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Not able to Read PDF file sent from EmailOutput Node
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.