In my previous post I described how to create a PDF file/report in Oracle BPEL (Create a JasperReport from Oracle BPEL).
Now I will describe how to sent this PDF file as attachment in an email.
After invoking the createBookService the outcome is used to construct the email message. In particular the filename and the Base64 encoded report.
Constructing the email
Open de mailBook2Maggie mail task by double clicking on it. The General tab of the email task definition is show.
For this example I used a fixed values for the to, subject and body fields. The from account is left on Default.
The attachment tab show a grid where the attachments can be defined.
Click the green PLUS sign to add an attachment definition.
The default attachment name is ‘attachment1’ and the default mime type is’ text/html;’.
This screen actually has a bit strange behavior. The created report is not of the ‘text/html;’ type.
Changing this value via this user interface could result in a very annoying exercise.
I have chosen to leave the defaults here and change the values in a different way. Close the email task definition screen by clicking OK.
Open the mail task by selecting the PLUS sign.
The mail task consist of the assignment of the email setting and the invocation of the email service.
The assignment activity can also be used to change the mailservice payload. Lets start doing this. Double click on it to open.
As shown in the screenshot, the email has a multipart content body.
This first part contains the email body and an indication of the body mime type.
The second part contains the report in the body, the mime type of the report and the name of the report.
This post ends with an example of how a received email looks in Maggies email box.
hi Marcel,
can you please send the code to kishore[DOT]mukala[AT]gmail[DOT]com
thanks in advance,
M.Kishore
I have send you an email with the code. Please let me know if you have not received it (might be blocked somewhere).
HI Nice example could you plz send me the code@ nagarur.nitk@gmail.com
Hi Glind,
I want to know how to create a pdf file (pdf file should be created from xml data provided as input) as an attachment in SOAP response