Friday, February 8, 2013

Send XML file as attachment using Email activity in SOA / BPEL 11g

Steps are:

1. Create a BPEL project. 
2. Modify input schema element 'process' to have 'To' and 'AttachmentBody' as string type elements. 
3. Insert a Email Activity inside BPEL.
4. Double Click on the Email activity and set / pass values to required fields. 


5. Create a Temp variable say 'EncodedTemp' and copy 'AttachmentBody' to the EncodedTemp' using assign activity.

6. Insert a JavaEmbedding Activity which will encode the contents of 'EncodedTemp' to Base64Encoding. Below is the code which is used - 

        Note: 
          To use Java Embedding you also need to import oracle.soa.common.util inside BPEL.
          Go to BPEL Source and paste import statements above Java Embedding activity -


7. Now Double click on Email activity again and click on Attachments. Set the values as shown below - 



Deploy the project and test it.


No comments:

Post a Comment