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.