Professional Documents
Culture Documents
http://www.anilaltunkan.com/oracle-3/e-
business-suite-oracle/oracle-ebs-service-
invocation-framework-business-events-sif/
In this tutorial, I am going to invoke an external test web service with SIF.
SIF mechanism is based on events, therefore we are going to define business events and
subscriptions. After that, we can raise events in pl/sql.
1. Login to E-Business Suite. Select Business Events function under Workflow Administrator Web
(New) -> Administrator Workflo menu.
2. Click to Create Event button.
7. Type WSDL url for the external web service and click to Next button. SIF is going to parse WSDL
and display available services, ports, operations in web service.
12. We need to create a second subscription in request event. This is need for request errors and it is
going to launch WFERROR workflow which will send a notification about error details to the
SYSADMIN. Click to the Create Subscription button.
13. Choose Source Type as external since it is going to get the error for external service. Choose
Rule Data as Key. Click to the Next button.
1. We are going to create a second event for service response. This event will capture service
response message. Click to the Create Event button.
5. Choose Rule Data as message and this action time will be Custom. Click to the Next button.
6. You can process response in java or pl/sql. We are going to create a pl/sql function which will fetch
event data. Pl/sql function should have a pre-defined skeleton. We will go into detail at next steps.
Click to the Apply button.
At this point, defining events and subscription process is completed.
Workflow Java Deferred Agent Listener (This is for JMS queue. Messages are going to be fetched
from WF_JAVA_DEFERRED table)
TABLE: xxanil_service_response
We are going to use this table for insering response of web service.
xxanil_service_response
Oracle PL/SQL
6 event_key varchar2(80),
7 event_name varchar2(80),
8 response clob,
9 creation_date date
10 );
11
13
PROCEDURE: get_service_response
insert_service_reponse
Oracle PL/SQL
FUNCTION: get_service_response
Pay attention to the skeleton of function. It must take two parameters subscription_guid in raw type
and event for in out nocopy wf_event_t type. We are going to specify response event name before
raising request event. After listeners finished their jobs, this function will be triggered by response
event with event data. We can fetch event key, event name, paramaters and event data from object.
get_service_response
Oracle PL/SQL
3 p_subscription_guid in raw,
5 is
6 l_node varchar2(30);
7 l_version integer;
8 l_from varchar2(2000);
9 l_eventName varchar2(80);
10 l_eventkey varchar2(80);
11 l_paramlist wf_parameter_list_t;
12 l_eventData clob;
13 l_messageHandle varchar2(100);
14 begin
15 l_eventkey := p_event.GetEventKey();
16 l_eventName := p_event.getEventName();
17 l_paramList := p_event.getParameterList();
18 l_eventData := p_event.getEventData();
20 return 'SUCCESS';
21 end get_service_response;
22
If external service has security, then we need to pass wsse parameters in header of the request. SIF
does not allow us to modify wsse header in code. We need to create a password key (not
password) in database. To do this, we are going to give an application, key name and password.
PASSWORD KEY
Oracle PL/SQL
declare
sysResp number;
appResp number;
2 declare
3 sysResp number;
4 appResp number;
10 begin
11
13 begin
16 from FND_RESPONSIBILITY
19 exception
22 fnd_global.apps_initialize(0,20420,1);
23 end;
24
26 end;
27 /
28 commit;
29
We are going to raise request event in pl/sql with wf_event.raise api. We need to specify some
neccessary parameters.
Important Note: If your body and header xml requests using namespaces, you must move them to
body and header in a proper manner.
Variables
l_parameters: wf_parameter_list_t table type parameter. We are going to add parameters in this
variable with another API.
variables
Oracle PL/SQL
l_parameters w f_parame
l_request_body clob;
l_request_header clob;
l_event_key varchar2 (5
1
3 l_request_body clob;
4 l_request_header clob;
Adding Parameters
WFBES_CALLBACK_AGENT Standard parameter for your agent. We are going to use "Web
Services IN Agent".
adding parameters
OCaml
w f_event.addparametertolist
p_name => 'WFBES
p_value => 'ANIL',
p_parameterlist => l_para
2 wf_event.addparametertolist (
6 );
8 wf_event.addparametertolist (
12 );
13
14 wf_event.addparametertolist (
18 );
19
20 wf_event.addparametertolist (
24 );
25
26 wf_event.addparametertolist (
30 );
31
32 l_request_header := '<xx:SOAHeader
xmlns:xx="http://xmlns.oracle.com/apps/xx/soaprovider/plsql/xx_test_service/">
33
<xx:Responsibility>TR_PAYABLES_MANAGER</xx:Responsibility>
34
<xx:RespApplication>SQLAP</xx:RespApplication>
35
<xx:SecurityGroup>STANDARD</xx:SecurityGroup>
36
<xx:NLSLanguage>TURKISH</xx:NLSLanguage>
37
<xx:Org_Id/>
38
</xx:SOAHeader>';
39
40
wf_event.addparametertolist (
41
p_name => 'WFBES_INPUT_taicsheader',
42
p_value => l_request_header,
43
p_parameterlist => l_parameters
44
);
45
46
wf_event.addparametertolist (
47
p_name => 'WFBES_INPUT_header',
48
p_value => l_request_header,
49
p_parameterlist => l_parameters
50
);
51
52
53 wf_event.addparametertolist (
57 );
raise
Oracle PL/SQL
l_request_body := '<test:Inp
<test:PARAM
</test:InputParam
2 l_request_body := '<test:InputParameters
xmlns:test="http://xmlns.oracle.com/apps/xx/soaprovider/plsql/xx_test_service/test_function/"
3 >
4 <test:PARAM>123</test:PARAM>
5 </test:InputParameters>';
6
1 commit;
2
1
3
Complete code:
Raise
Oracle PL/SQL
declare
l_parameters w f_parame
l_request_body clob;
l_request_header clob;
2 declare
4 l_request_body clob;
5 l_request_header clob;
7 begin
8 wf_event.addparametertolist (
1
2 wf_event.addparametertolist (
1 p_name => 'WFBES_SOAP_PASSWORD_MOD',
3
p_value => 'SQLAP',
1
4 p_parameterlist => l_parameters
1
5 );
1
6
wf_event.addparametertolist (
1
7 p_name => 'WFBES_SOAP_PASSWORD_KEY',
2
0 wf_event.addparametertolist (
2 wf_event.addparametertolist (
4
p_name => 'WFBES_CALLBACK_AGENT',
2
5 p_value => 'WF_WS_JMS_IN',
3 <xx:SecurityGroup>STANDARD</xx:SecurityGroup>
0
<xx:NLSLanguage>TURKISH</xx:NLSLanguage>
3
1 <xx:Org_Id/>
3
2 </xx:SOAHeader>';
3
3
wf_event.addparametertolist (
3
4 p_name => 'WFBES_INPUT_taicsheader',
3
7 wf_event.addparametertolist (
4 wf_event.addparametertolist (
1
p_name => 'WFBES_INPUT_tAICSHeader',
4
2 p_value => l_request_header,
5 commit;
2 end;
5
3
5
4
5
5
5
6
5
7
5
8
5
9
6
0
6
1
6
2
6
3
6
4
6
5
6
6
6
7
6
8
6
9
7
0
7
1
7
2
7
3
7
4
7
5
7
6
https://blogs.oracle.com/ebusinesssuiteintegration/entry/invoking_web_service_from_orac_1
https://blogs.oracle.com/ebusinesssuiteintegration/entry/r121_-_invoking_web_service_fr
Tags: apps, business events, oracle, oracle apps, oracle ebs, sif, subscriptions, web service invoke,
WFBES_INPUT_header, WFBES_SOAP_PASSWORD_KEY