SOA Suite - 11.1.7.6
A lot has already been written at this blog about how to configure UMS Adapter and read attachments from it. Hence this post is just to describe additional points to read/process the attachments. The post assumes that you're able to receive the incoming email using UMS Adapter successfully and able to get the BPEL process instantiated.
How to Read/Fetch the Attachment?
BPEL 1.1 - It's fairly simple in BPEL 1.1 using the following syntax in the Assign Activity.
- Receive1_ReceiveNotification_InputVariable - is the variable created out of Receive Activity connected to Inbound UMS Adapter
- Body, ns2:message/ns2:attachment - are the variable part and element inside the variable respectively created by default.
- ns2:/attachment [1] is used to read the first attachment always. You may want to loop through all the attachments and choose the one you desire based on Content-Type or Attachment Name or etc. Read my another post on how to retrieve the attachment names from the Email attachments.
- CustomAttachmentVariable - is the custom Element type variable of Attachment Message with the namespace {http://platform.integration.oracle/blocks/adapter/fw/metadata/ReadEmailAttachment}message. I created this variable simply to complete the Assign. You may further access this variable for extracting the contents of the attachment or writing to file etc.
BPEL 2.0 - It's not a rocket science here as well, just one thing to note is that default BPEL 2.0 variable format ($Receive1_ReceiveNotification_InputVariable.body/ns2:attachment) (note the . between InputVariable.body ) is not supported by the ora:getAttachmentContent() function. So you have to explicitly write the variable in the BPEL 1.1 format. You can assign intially from the Design View and then go into BPEL source and modify the default Assign code generated to below: (ora:getAttachmentContent('Receive1_ReceiveNotification_InputVariable' , 'body','/ns2:message/ns2:attachment[1]')) - note the body part.
What to do with the Attachment read?
There are basically 3 things that you may want to do with the attachment just read. To keep this post concise, they have been put into separate posts.
- Write the incoming attachment to another file
- Forward the incoming attachment
- Parse the attachment content into XML for further use within the process
Please feel free to navigate through and let me know if any doubts! Happy Emailing!