Oracle EBS Service Invocation Framework (Business Events – SIF)

Share Button

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.

You can find detailed information in the following link: https://docs.oracle.com/cd/E18727_01/doc.121/e12169/T511175T513090.htm

We need to define business events for our request and response.

Request Business Event

1. Login to E-Business Suite. Select “Business Events” function under “Workflow Administrator Web (New) -> Administrator Workflo” menu.

sif 001

 

2. Click to “Create Event” button.

sif 002

 

3. Fill the event information and click to “Apply” button.

sif 003

4. Search for your event and click to “Subscription” icon.

sif 004

5. Click to “Create Subscription” button.

sif 005

6. Fill the subscription information and click to “Next” button. We are going to use this event subscription for invoking web service. “Phase” parameter specifies whether the invoke process is going to be synchronised or not. However, as far as I know, this parameter is only working for the events which are raised in java. In this example, we are going to raise event in pl/sql, therefore it is going to be queued in wf_java_deferred table. Data in message queue table is processed by an agent listener periodically. “Rule” parameter should be “Message” since we are going to send a request message to external service.

 

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.

sif 007

8. Select “Service” and click to “Next” button.

sif 008

9. Select “Port” and click to “Next” button.

10. Select “Operation” and click to “Next” button.

sif 010

11. Fill “Owner Name” and “Owner Tag” for your subscription. “Java Rule Function” specifies invoking java function. You can extend this class and write your own invoker if you need. Click to “Apply” button.

sif 011

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.

sif 012

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.

sif 013

14. Choose “Workflow Type” as “WFERROR” and “Workflow Process” as “DEFAULT_EVENT_ERROR2”. Type owners and click to the “Apply” button.

sif 014

 

Final view for request event:

sif 016

 

Response Business Event

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.

sif 0172. Fill the event information and click to the “Apply” button.

sif 018

3. Search for event and click to “Subscription” icon.

sif 019

4. Click to “Create Subscription” button.

sif 020

5. Choose “Rule Data” as message and this action time will be “Custom”. Click to the “Next” button.

sif 021

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.

sif 022

 

At this point, defining events and subscription process is completed.

EBS Service Agents

Make sure that following agents are up and running properly.

  • Web Services IN Agent
  • Web Services OUT Agent
  • Workflow Java Deferred Agent Listener (This is for JMS queue. Messages are going to be fetched from WF_JAVA_DEFERRED table)

sif 023

TABLE: xxanil_service_response

We are going to use this table for insering response of web service.

 

PROCEDURE: get_service_response

We are going to use this procedure for dml.

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.

Create password key for secure services

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.

Execute following script with your own credentials:

Raising the request event

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.
  • l_request_body: request body xml
  • l_request_header request header xml
  • l_event_key: raise key

Adding Parameters

Parameter Name Description
WFBES_SOAP_USERNAME Standard parameter for wsse (security) username.
WFBES_SOAP_PASSWORD_MOD Standard parameter for our password key module.
WFBES_SOAP_PASSWORD_KEY Standard parameter for our password key name.
WFBES_CALLBACK_EVENT Callback event which will trigger response function.
WFBES_CALLBACK_AGENT Standard parameter for your agent. We are going to use "Web Services IN Agent".
WFBES_INPUT_taicsheader Standard parameter for header.
WFBES_INPUT_header  Standard parameter for header.
WFBES_INPUT_tAICSHeader  Standard parameter for header.


Adding body and raise

Complete code:

Check following link for raising event from Workflow:

https://blogs.oracle.com/ebusinesssuiteintegration/entry/invoking_web_service_from_orac_1

Check following link for raising event from OAF:

https://blogs.oracle.com/ebusinesssuiteintegration/entry/r121_-_invoking_web_service_fr