Hi,
Today we are going to configure UMS adapter in SOA to download mail attachment & push it on file/FTP location.
Today we are going to configure UMS adapter in SOA to download mail attachment & push it on file/FTP location.
·
Click on Email Driver properties.
· In EM FMW Control, open the User Messaging
Service node in the navigator and select the usermessagingdriver-email for the
relevant managed server. From the context menu, select Email Driver Properties.
When there no configuration yet, you will create a new one. If you already
configured the SOA Suite for outbound mail traffic, you can edit that
configuration for the inbound direction.
·
Click on create
·
In the property overview, there are some
properties to set:
Press the OK button at the top of the page to apply all configuration changes.
- The Email Receiving protocol for GMail is IMAP.
- The Incoming Mail Server is imap.gmail.com.
- The port should be set to 993 and GMail wants to communicate over SSL, so the checkbox should be checked.
- The Incoming MailIDs are the email addresses that correspond to the lust names under Incoming User IDs. For GMail these can both be the full GMail email-addresses.
- There are several ways to configure the password. The least safe one is by selecting Use Cleartext Pasword and simply typing the password for the GMail account in the password field.
- The password is then stored somewhere on the WebLogic server in readable form.
Load Certificate into Keystore:
- Download SSL certificate of your Mail server, In case of Gmail download complete certificate chain.
- Open Demo Trust.JKS file as this file is default mapped as trust store for our weblogic env.
- Import SSL certificate chain using KEYTOOL command or any other UI tool.
- The interaction between the UMS server and GMail’s IMAP API takes place over SSL. That means that the WebLogic managed server on which the UMS service runs has to have the SSL certificate for the IMAP server loaded in its local.
- Do a full bounce of SOA env.
JDEV Configuration:
- Create one SOA project
- Drag UMS adapter in SOA composite
Get file name in BPEL:
substring-before (substring-after(concat(ora:getAttachmentProperty('Content-Type', 'inputVariable','body','/ns3:message/ns3:attachment[2]'), ';'), 'name=' ), ';')
attachment[2] is to get file name of attachment, In case you have multiple attachment in mail you can get them using index like 2,3..N.
Get attachment content and upload in file directory:
Create one file adapter.
Design invoke activity for same.
Get file attachment data as base64 and upload in file directory using attachment function.
ora:getAttachmentContent('inputVariable','body','/ns3:message/ns3:attachment[2]')
Test results:
- Send a mail to configured email ID.
Other imp function about mail attachment processing:
ora:writeBinaryToFile()
There's inbuilt function ora:writeBinaryToFile() that automatically extracts the attachment from the Attachment href (in the binary format) and writes to the specified target file (hence you don’t need to use ora:getAttachmentContent() in front of it). Follow the below steps to write it to file using ora:writeBinaryToFile() .
Assign the following in the Source side. In BPEL source , comple Assign statement would look like as shown below.
<copy>
<from>ora:writeBinaryToFile('inputVariable','body','/ns3:message/ns3:attachment[2]', '/u01/app/oracle/userdir/NewAttachment.xml')</from>
<to>$CustomAttachmentVariable/ns2:attachment</to>
</copy>
How to retrieve name of the Email Attachment:
Once you have made Attachments to work in your BPEL process and able to parse them, it may be necessary to retrieve the actual name of the email attachment read. The best way to do that is using out-of-the-box function as given below
ora:getAttachmentProperty('Content-Disposition', 'inputVariable','body','/ns3:message/ns3:attachment[2]')
The above should return attachment; filename="test.txt"; however, nothing is as simple in this world and to make it true, it is a known BUG:19492062. Luckily, we have a patch 1941333.1available to apply and get going but it may be time consuming to request a patch, do the impact assessment and get it applied across all environments. Whilst that may be the ideal solution in the long term but to quickly test and retrieve the attachment name you can use property Content-Type as given under.
<assign name="AssignEmailAttachmentName">
<copy>
<from>substring-before (substring-after(concat(ora:getAttachmentProperty('Content-Type', 'inputVariable','body','/ns3:message/ns3:attachment[2]'), ';'), 'name=' ), ';')</from>
<to>emailAttachmentName</to>
</copy>
</assign>
ora:getAttachmentProperty() function on Content-Type returns text/plain; charset=UTF-8; name=test.txt; any additional text;
Substring-before() and substring-after() have been done to intelligently extract string after name=
emailAttachmentName- is a string type custom variable to store the attachment name
Good post....thanks for sharing.. very useful for me i will bookmark this for my future needs. Thanks.
ReplyDeleteAttache Handle Manufacturer in Delhi
I really liked your blog article.Really thank you! Really Cool.
ReplyDeleteOSB online online training
OTM online online training
SAS online online training
structs online online training
Webmethods online online training
Wise package studio online online training
Python Django online online training
R Programming
ReplyDeleteThanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle ADF . Actually I was looking for the same information on internet for Oracle ADF and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more aboutOracle ADF . By attending Oracle ADF Training .
ReplyDeleteThanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle SOA Training
. Actually, I was looking for the same information on internet for Oracle SOA Interview Questions and Answers
and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more about Oracle SOA Tutorial also.
Ostingillioa_1993 Angela Freedom https://wakelet.com/wake/Nc2K5tYybEAoUWonfgGxU
ReplyDeletethetholooki
tutaKpu_moScottsdale Melissa White link
ReplyDeletelink
link
https://colab.research.google.com/drive/1Qz1gbTZ_mOwTaAkhmlFxzci3pZb7vA2c
minvidysno
perafricpo Jayson Sandell Bootstrap Studio
ReplyDeleteAvid Pro Tools
https://thecracks.net/category/multimedia/
fthehmuncakal
Vdiubi0ul_me Sam Taylor Software
ReplyDeletesoftware
moordmodasam