Tuesday 15 November 2011

Oracle SOA - Email notification using Gmail Server and Windows OS

If you want to send email using gmail and on Windows platform. Follow this blog..

You need to follow the steps mentioned in the blow URL to set up the soa-server and creating composite.

http://technology.amis.nl/blog/6019/configure-soa-suite-11g-for-sending-email-notifications-with-google-mail

After completing the steps above we need to setup the keystore with the cert for connecting to Gmail server. Follow the steps below to do that in Windows OS. For linux you can follow the steps mentioned in Comment# 5 of the above blog

(NOTE - Before you start developing SOA Composite you can setup the server and then setup the certificates and test the email notification directly from EM without any SOA Composite. So, it is up to you either do all the setup first and make sure it works and then start with the SOA development. Steps to setup certificates and testing notification through em follows...)

1) You need to download OpenSSL to get the SSL cert key from gmail. You can download and install OpenSSL into your OS from the URL http://gnuwin32.sourceforge.net/packages/openssl.htm and download complete setup.
2) After the installation is complete go to the bin directory - C:\GnuWin32\bin and run the file openssl as admin.
3) In the command prompt that opens type the following command
s_client -connect smtp.gmail.com:465
s_client -connect imap.gmail.com:993

1st command is to get the certificate for smtp and the 2nd is for getting for imap if you want to receive mail from your composite. If you just want to send a mail then you can get cert for smtp alone.

And copy the content inbetween BEGIN CERTIFICATE and AFTER CERTIFICATE and save in two separate files called smtp.cert and imap.cert from 1st and 2nd command respectively.


You can have this file in the same folder C:\GnuWin32. Once we have the cert files we need to create a new trust store and import these certificates.
4) Open an command prompt and execute the following command after you navigate to the folder in which you have created the cert files
keytool -import -alias imap.gmail.com -keystore trusted-certificates.jks -file imap.cert
keytool -import -alias smtp.gmail.com -keystore trusted-certificates.jks -file smtp.cert


the above command will ask for a password which will be required later. So enter a new password and remember it so that we can use in the next step.

The above command will create a file called trusted-certificate.jks in the same folder which we will use in the soa server now.
5) Navigate to your user-directory path similar to the following D:\Oracle\Middleware\user_projects\domains\soa_domain\bin and edit setDomainEnv.sh, replace the existing javax.net.ssl.trustStore property setting with “-Djavax.net.ssl.trustStore=C:/GnuWin32/trusted-certificates.jks -Djavax.net.ssl.trustStorePassword=<password you used>”. Also change the setDomainEnv.cmd file with the same content with back slash - -Djavax.net.ssl.trustStore=C:\GnuWin32\trusted-certificates.jks -Djavax.net.ssl.trustStorePassword=weblogic1.
6) Restart both SOA and ADMIN server.

After completing the above steps if you want to check the mail server configuration diretly from EM instead of developing the SOA Composite. You can do that by following the below steps.
1) Navigate to your em console - http://localhost:7001/em
2) Expand SOA and click on soa-infra.
3) In the right pane you need to expand Service Engines header (Use scroll bar to navigate to the bottom of the page to see this menu).
4) Click on Human Work Flow Engine
5) Now Click on Notification Management tab and then click on Send Test Notification button.
6) Give a To address and select Email as the Channel from the dropdown and give other values and send the message. You should check the SOA-SERVER log for any error messages







1 comment:

  1. looking for ADF ONLINE TRAINER please reach me at info@apex-online-it-training.com

    ReplyDelete