Friday, 20 December 2013

Configuring EmailNotification in Oracle Soa 11g


Hi Guys

Oracle SOA Suite 11g supports a number of different notification channels through the User Messaging Service (UMS). This blog provides a step-by-step guide for configuring and testing email notification. Once email notification has been configured, emails can be sent from SOA Suite components such as BPEL processes and Human Tasks. For this example, Gmail will be used as the mail server.


Before anything, I'll just introduce you to the protocols used in EMAIL communication
Sending a Mail
SMTP : protocol to send mail to a mail server

Retrieving a Mail
POP3 : Downloads the mail from the mail server in to a local machine. This will be helpful if you have only one machine in which you'll always check your emails.
IMAP : Doesn't actually download the email to the local server(you can always do it if required). It helps you sync up your mail across machines, and gives the capability of having hierarchical maintenance of your emails ie, you can maintain a folder structure for specific mails. You create a folder in one machine, drag some msg's into it, that will be automatically synced up when you chk your mails from another machine as the changes are not done in your local machine, but the server.  Also, when your INBOX is too huge, it will just retrieve headers to your mail client, only when you click on it, it will actually download the message to show you the details. This makes the performance better than POP3.

For using EMAIL notification service, you may not have your own email servers. You can always use a freely available mail like gmail.

This example shows you how to use gmail as the mail server for Email Notifications.

Configuring Email notification service involves 4 steps(first step can be ignored if your mail server doesn't need SSL)


Configuring Email Notification

To support email notification from SOA Suite 11g the UMS email driver and workflow notification properties to be configured with the mail server details. This can be done through the Enterprise Manager Fusion Middleware Control console (e.g. http://localhost:7001/em) as follows:
  1. Navigate to the Email Driver Properties page available under User Messaging Service > usermessagingdriver-email


  2. Update the following properties according to your mail server configuration:
    OutgoingMailServer - The SMTP hostname
    OutgoingMailServerPort - The SMTP port
    OutgoingMailServerSecurity - The type of security (e.g. SSL)
    OutgoingUsername - The mail user account
    OutgoingPassword - The mail user password


    1. Click Apply to save the changes.
       
    2. Right-click on soa-infra under SOA and navigate to the Workflow Notification Properties page available under SOA Administration.


       
    3. Set the Notification Mode to 'Email' and enter the default values which you wish to use for from, actionable and reply to email addresses.

      Configure the below mentioned properties
    Property
    Value
    Comments
    -----------------------------
    FOR SENDING MAIL
    -------------------------------------
    OutgoingMailServer
    smtp.gmail.com
    As mentioned, SMTP is used to send mails
    OutgoingMailServerPort
    465
    This is the port gmail uses for SMTP
    OutgoingMailServerSecurity
    SSL

    OutgoingDefaultFromAddr
    <mydefaultmailId@gmail.com>
    The default FROM address (if one is not provided in the outgoing message).
    OutgoingUsername
    <mymailId@gmail.com>

    OutgoingPassword
    Password of the gmail id
    Option to be selected is "Use Cleartext Password"
    ---------similarly for----
    FOR INCOMING MAIL
    -------------------------------------
    IncomingMailServer
    imap.gmail.com
    As mentioned, IMAP is used to receive mails
    IncomingMailServerPort
    993
    This is the port gmail uses for IMAP
    MailAccessProtocol
    IMAP

    IncomingMailServerSSL
    No need to check this option

    IncomingMailIDs


    IncomingUserIDs


    IncomingUserPasswords


       Email: From Address  = taskdeliveryflow@gmail.com
       Email: Actionable Address       =  taskdeliveryflow@gmail.com
       Email: Reply To Address =Notaskflow@gmail.com
    1. Click Apply to save the changes to the workflow notification properties.
       
    2. Restart the SOA server for the changes to take effect. If you are using Gmail or any other mail server that requires SSL you will need to perform the steps in the next section. In this case, you may wish to hold off on restarting the server before these steps are performed. This will save you the trouble of having to restart twice.

    Import the SSL Certificates to the Java Keystore

    Before SOA Suite can send emails with Gmail there are some SSL certificates that will need to be imported. This step can be ignored if sending from an alternative mail server that does not require SSL.
  3. Download the Gmail IMAP and SMTP certificates. This can be done with OpenSSL (Unix / Windows) by running the following from command prompt:
    • openssl s_client -connect host:port
      • where Gmail SMTP host:port is smtp.gmail.com:465
      • where Gmail IMAP host:port is imap.gmail.com:993
         
  4. Create a new file for the SMTP and IMAP certificates using the content between BEGIN CERTIFICATE & END CERTIFICATE



  1. Use the Java Keytool to import the two certificates into a new or existing keystore. The keytool executable is available under the JAVA_HOME/bin directory. The following command can be used to import a certificate:
    • keytool -import -alias AliasName -keystore KeystoreLocation -file CertificateLocation
      • For example:
        • keytool -import -alias gmail-imap -keystore gmail-keystore.jks -file imap.txt
        • keytool -import -alias gmail-smtp -keystore gmail-keystore.jks -file smtp.txt
    • When prompted, enter a password for the keystore.
       
  2. Add the following system properties to the WebLogic server startup arguments:
    -Djavax.net.ssl.trustStore=CertificateLocation-Djavax.net.ssl.trustStorePassword=CertificatePassword
    This can be done in Arguments field available under the Server Start tab for the SOA Server (e.g. soa_server1) in the WebLogic Administration Console (e.g. http://localhost:7001/console) or by adding the properties to the DOMAIN_HOME/bin/setDomainEnv.cmd (or setDomainEnv.sh). For example:
    set EXTRA_JAVA_PROPERTIES=%EXTRA_JAVA_PROPERTIES% -Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\gmail-keystore.jks -Djavax.net.ssl.trustStorePassword=changeit
  3. Once you are done with this edit, one step is pending, where you will tell the managed server that a custom keystore is setup and has to be considered.
    This is done by opening the Admin Console(<adminHost>:<adminPort>/console --> Environments --> Servers --> click on soa_server1)
    Click on Keystores, and change the Keystores to "Custom Identity and Java Standard Trust"

    Start the SOA server (or restart it if it is already running).

Testing Email Notification

Now that we have configured outbound email notification, we want to test our configuration easily without having to create a BPEL process or human task to do this. Fortuntately, we can do this from Enterprise Manager Fusion Middleware Control.
  1. Right-click on soa-infra under SOA and navigate to the Human Workflow page available under Service Engines.


     
  2. Select the Notification Management tab.
     
  3. Click Send Test Notification


     
  4. The Send Test Notification dialog box should now appear. Enter the email subject, content, to address and be sure to select 'Email' for the channel. Click SendOnce the email has been sent, you should receive a value of 'SENT' for ResponseYou can now close the dialog box.




          Note: Ensure that the email has been received.



    HappyLearning


                                                                                                                       By DeepthiReddy

2 comments:

  1. Thanks for sharing this great information on Oracle SOA. Actually I was looking for the same information on internet for SOA Interview Questions 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 SOA by attending Oracle SOA Training training .



    ReplyDelete
  2. Thanks 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 Interview Questions and Answers
    . Actually, I was looking for the same information on internet for
    Oracle SOA Training 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.

    ReplyDelete