Beruflich Dokumente
Kultur Dokumente
One of the ways of the SOA Suite 11g for communicating with the outside world apart of
course from web service calls and interaction via technology adapters is through the new User
Messaging Service (UMS), a facility installed in the SOA Domain during installation of the
SOA Suite. The UMS enables two-way communication between users (real people) and
deployed applications. The communication can be via various channels, including Email, Instant
Messaging (IM or Chat), SMS and Voice. UMS is used from several components in Fusion
Middleware, for example BPEL, Human Workflow, BAM and Web Center and can also be used
from custom developed applications.
This article describes how the User Messaging Service can be configured to use Google Mail as
its mail server for sending and receiving emails and how we can make use of that facility from a
simple BPEL process. Note that the steps described in this article apply to any public email
server Yahoo, Hotmail, Lycos and others as well as your own email server.
Prerequisites
Before you can apply this article, you need to have installed the SOA Suite 11g, configured the
SOA Domain and have the Admin Server and the SOA Server running. You also need access to
the Oracle Enterprise Manager Fusion Middleware Control Console. You will also need
JDeveloper 11g with the SOA extension in order to create a SOA Composite Application through
which to test the email sending capabilities.
The form that is now shown allows you to set various properties on the Email Driver, including
the details about the email server to be used by the driver for email operations.
The properties that need to be configured for sending emails are indicated in the red rectangle.
They are:
OutgoingUsername the Gmail user account from which the email is sent
Press Apply. To have these settings take effect, the Driver has to be restarted. This happens
automatically I presume when the SOA Server is restarted, which we will do at the end of the
next step. Otherwise, you can use the options Shutdown and Start in the dropdown menu option
Control.
The Workflow Notification Properties are shown. Only one is really important at this point: the
Notification Mode (default value is None) must be set to either All or Email, otherwise any
notification is not really sent onwards by the SOA Suite to UMS!
At this point, the SOA Server needs to be restarted to have the changes take effect.
You will be prompted to provide a name for the application for example
HelloWorldEmailSOAComposite and a name for the project the same or any other name will
do nicely. JDeveloper then asks you what type of composite application this will be; pick
Composite with BPEL on the Configure SOA settings step. Press Finish to have the application,
project and service composite created.
3. The Create BPEL Process dialog comes up next. Specify the name for the new BPEL process
HelloWorldEmail and the Template: Synchronous BPEL process. Leave the checkbox
Expose as SOAP Service checked and accept other defaults as well. Press OK.
4. The BPEL editor opens up. You will see the basic structure of the BPEL process with a receive
and a reply activity, by default configured to receive a single string and return a single string.
You need to add one activity to set the value of that string result: drag and Assign activity from
the Component palette and drop it between the receive and reply activities already in the process.
Double click the assign activity, to open the editor. Click the green plus icon and select the Copy
Operation from the drop down list. The client:result element in the outputVariable is the obvious
target for the Copy Operation. Use an expression that concattenates the string "Hello dear " with
the client:input element in the inputVariable.
5. Drag an Email activity from the Component Palette and drop it under the Assign Activity.
The configuration of the email activity must be specified. This includes the subject and body of
the message (both can contain dynamic values from BPEL process instance) as well as the
addressee (again, can be derived dynamically as well as defined at design time):
composite application. After a few seconds, the result from the service should be displayed,
something to the effect of Hello dear Lucas.
As part of the now completed instance of the composite application, a call is supposed to have
been made to the Notification Service that in turn engaged the UMS that approached the Gmail
server to send an email on behalf of the BPEL process instance. We can see trace of this message
on the Message Status page for the User Messaging Service in the Enterprise Manager console.
An even better place to find the email is of course in the Inbox of the email account to which the
email message was sent
(as well as in the Sent folder for the email account from which the message was sent):