Extract emails list from Group ID for BPEL/BPM Notification service

Within Oracle SOA suite, it is possible to create email, SMS, fax or instant messaging based notification via the Notification task usable within BPEL or BPMN processes. For setting up the different communication channels, you can refer to this excellent blog from Rubicon Red - http://www.rubiconred.com/blog/email-notification-with-soa-suite-11g/

However, unlike the notification within the Human Task where we can only provide user id or group id, we need to explicitly specify the email addresses or the phone numbers when using the Notification service independently. 

To address this need we can leverage the Identity Service functions available in BPEL to extract users properties. You can use the instructions below to extract those properties, either from an userid or from a groupid. But if you are lazy, you can download the SOA project with the processes below from here :)



Extract email address and mobile number from an userid


This step is fairly simple. We can use the Identity Service function 'ids:getUserProperty' to extract the user email address, or any other attribute available within the realm.

1. Create a synchronous BPEL process with the following input and output message type




2. Drag an Assign activity into the process 



3. Open the Assign Task, and drag the XPath Expression into the email attribute



4. Use the following expression to extract the email address from the userid ids:getUserProperty($inputVariable.payload/client:userid,'mail')



5. Then map the phone attribute using the expression ids:getUserProperty($inputVariable.payload/client:userid,'mobile') using the same approach

6. Finally, deploy and test the process







Extract email list from from a groupid


To extract an email list from a groupid, the process is a little bit more complicated. To summarize, there are 2 majors steps:

a. Extract the list of userid from the groupid, using the Identity Service function ids:getUsersInGroup()
b. Parse the userid list, and concatenate the email into a list from each userid, using the same ids:getUserProperty() as shown above

The challenge is to be able to extract the userid list, which is dynamic, and then be able to parse over this dynamic list to extract the property that we need. After some investigation, this is a way to achieve with a synchronous BPEL process

1. Create a synchronous BPEL process with the following variables

- usersList is mapped to the Users element specify in the XML schema here
- index and size are two int variables, with index initiated to "1" 



2. Drag and drop the Assign and While activities as shown below





3. In ExtractUsersList assign activity:

- Map the following functions onto $usersList/ns1:Users/ns1:user (using CopyList assignment) and $size:

ids:getUserInGroup($inputVariable.payload/client:groupid,true())
--> $usersList/ns1:user

count($usersList/ns1:user)
--> $size




4. In ParseUsersList while activity, use the following condition to loop over the $usersList/user elements 



5. Finally, in ConstructEmailsList assign activity add the logics to extract each email address and concatenate the result into a list with the seperator:


concat($outputVariable.payload/client:emails,
ids:getUserProperty($usersList/ns1:user[$index],'email'),
$inputVariable.payload/client:separator)

==>  $outputVariable.payload/client:emails

$index+1
==> $index



6. The BPEL process is now completed. Deploy, and test it out !











Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hi, I am Manh-Kiet Yap (known as Kiet @oracle) and I'm currently the Technical Director at the APAC Advanced Customer Services.

I've recently received my 15 years of long service award, after being successively Technical Consultant in France, Presales at Hong Kong, FMW Product Manager in EMEA, Presales Mgr in APAC and finally Architect at Oracle ACS.

With my 15 years experience around Middleware, I hope you will find this blog valuable if you are navigating around Oracle Fusion Middleware !

View Manh-Kiet Yap's profile on LinkedIn

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today