Sunday 22 April 2012

Sending Mail from OSB 11g (11.1.1.3.0) to Apache JAMES

In this post I will discuss about sending mails from OSB 11g. I will use Java Apache Mail Enterprise Server (JAMES) as a mail server.

First of all download Apache JAMES 2.3.2 Binary (ZIP Format) from
here. Follow below links for installing it and doing initial configuration –

http://james.apache.org/server/head/installation_instructions.html
http://wiki.apache.org/james/JamesQuickstart

I configured a mail server anuj.com and created two users oracle@anuj.com and testuser@anuj.com

Now I will configure Oracle Service Bus. First of all create a SMTP Server resource in OSB configuration. For creating a SMTP server resource go to System Administration --> Global Resources --> SMTP Servers and click on “add” (You have to click on “Create” button in the change center to create a new session for your editing, otherwise “add” button will remain disabled)
Provide the details there as shown below-







After creating SMTP server, I will create one Email business service to send messages to JAMES. You may create a business service inside any OSB project.

I am creating a business service named “TestLocalMailServer” which is a “Messaging Service” type business service –










Click on next and it will ask you to provide message type configuration details(request and response message type) –











I select request message type as “Text” and Response message type as “None” (because no response is expected in email transport as it is a one way process)

Click on next and provide the transport configuration details. Select “email” in transport dropdown list and add an endpoint URI oracle@anuj.com –









Click on next and provide the Email transport configuration. In “SMTP Server” dropdown list, select the SMTP server you created earlier. Provide the “from” and “reply to” details as well –









Now click on “Last” (to choose default for rest of the settings) and you will see below configuration –















Save the business service details and activate the configuration using Change center.

You are done with the configuration part now and your business service is ready to be tested.

Open the OSB test console by clicking on the “bug” icon against the business service name. Provide the message/text you want to mail across and set the subject line-














Now click on “Execute” and if processing goes successful then you would see “There was no response.” text under “Response Document” section –







Now to check whether actually mail has been received on JAMES, go to james-2.3.2\apps\james\var\mail\inboxes\oracle directory and should see two files there (for one message) –





Open the file with extension “FileStreamStore” in any text editor and it will show you content below content –








So you are done with sending mails from Oracle Service Bus to Apache JAMES

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...