Tuesday, December 6, 2022

OIC - Twilio adapter - send SMS / WhatsApp from Oracle Integration

UseCase: Using Twilio adapter, we can send SMS / whatsapp from OIC. Here, we will send a sms and whatsapp messages as well using Twilio adapter.

Implementation detailed steps:

First step: Get a Twilio Trial account from Twilio.com . Then a Trial number - this will be used to send messages

Messaging >> get Setup >> create messageing service.








Second Step: Create a Twilio connection

My first Twilio account >> gather account sid, Auth token , required for OIC twilio connection.

Also take my twilio phone number which will be used as sender number.



Third step: Create an Integration and invoke Twilio adapter

Exposing a rest adapter to receive sender , receiver and sms details and send a status .








Select created twilio adapter and configure.



Select operation as Send SMS or MMS.




Complete the mapping 




Add tracking, save and activate and test.


Sms on phone:.

Fifth step: Add verified called Ids from Twilio trial account




For send Whatsapp messages, follow the below steps:

Twilio account >> Messaging >> Try it out >> Send a WhatsApp Message



Activate your sandbox


Save the number provided in the screenshot in your mobile device and write below code to connect:
Join <Sandboxname>

My case: Join page-giant



Sandbox is connected.


Test the same sms integration with "whatsapp:" prefix before the sender and receiver numbers as below:


Bang! We have received the whatsapp message.


To disconnect the sandbox, just write "stop".



Reference:


Friday, December 2, 2022

OIC - How to call DB Procedure Asynchronously

Usecase: Here, we will create a db package. In the package, we will create 2 procedures. 1st one, wrapper proc which will call the 2nd main proc asynchronously using dbms_scheduler.create_job() function.

**call the procedure via dbms_scheduler.create_job for a single immediate run. Parameter values for create_job to support single immediate run:

Job_name: a unique name say, 'async_main_proc' concatenated with attribute1 to prevent concurrency conflict
Job_type: PLSQL_BLOCK
Job_action: plsql block invoking main procedure async way.
Enabled: TRUE ( DEFAULT is false)
Auto_drop: TRUE ( default is TRUE)

Why we are creating/invoking async procedure:
Suppose we are invoking a db service procedure and if it takes more than 5 minutes to complete, then the process will be timed out. Even if the proc does not have OUT parameter, proc will be executed in synchronous mode and it waits for the completion of procedure execution. To overcome this limitation, first we need to create a wrapper procedure which calls the main procedure using dbms scheduler option inside the wrapper procedure.

Detailed steps:

Create a table:

Create table async_main_proc(
Attribute1 varchar2(200),
Attribute2 varchar2(200));

DB package specification:

Create or replace package XX_ASYNC_DEMO_PKG
As
     Procedure wrapper_main_proc(
       Attribute1 in varchar2,
       Attribute2 in varchar2);
     Procedure async_main_proc(
       Attribute1 in varchar2,
       Attribute2 in varchar2);
End xx_async_demo_pkg;

DB package Body:

Create or replace package body xx_async_demo_pkg
As
     Procedure wrapper_main_proc(
       Attribute1 in varchar2,
       Attribute2 in varchar2)
       As
         Begin
         Dbms_output.put_line('--- start wrapper proc ---' || systimestamp);
         --A separate procedure called asynchronously
         Dbms_output.put_line('before async_main_proc' || systimestamp);
         Dbms_scheduler.create_job(
           Job_name => 'async_main_proc'||Attribute1,
           Job_type => 'PLSQL_BLOCK',
           Job_action =>
           'BEGIN 
 xx_async_demo_pkg.async_main_proc('''||Attribute1||''','''||attribute2||''');
           End;',
           Enabled => TRUE,
           Auto_drop => TRUE,
           Comments => 'call main proc steps');
         Dbms_output.put_line('after async_main_proc' || systimestamp);
         Dbms_output.put_line('--- end wrapper_proc' || systimestamp);
End;

     Procedure async_main_proc(
       Attribute1 in varchar2,
       Attribute2 in varchar2)
       As
         Sql_stmt varchar2(200);
         Begin
           Dbms_output.put_line('--- start async_main_proc ---' || systimestamp);
           --Dbms_session.sleep(300);
           Sql_stmt := 'insert into      async_main_proc(attribute1,attribute2) values(:1,:2)';
           Execute immediate sql_stmt using attribute1,attribute2;
           Dbms_output.put_line('--- end async_main_proc ---' || systimestamp);
     End;
End xx_async_demo_pkg;

Test the procedure from db:
Exec xx_async_demo_pkg.wrapper_main_proc('test','abc')

OIC integration flow: Create the Database connection and call the package and wrapper procedure using db adapter.



Test from DB:


Reference:


Tuesday, November 29, 2022

OIC - Use REST adapter with multiple resources or Multiple Verbs in Oracle Integration Cloud

Here, we will see how to use REST adapter with multiple resources and verbs support in Oracle Integration Cloud(OIC).

Usecase: We will create a calculator service with 2 resource operations addition and subtraction with rest adapter multi resources or verbs support. In this case, we have used same verb as post with 2 different resource operations.

Detailed steps:

Choose App driven Orchestration integration style.


Provide integration name, package >> Create.


We see empty canvas, Drop a rest adapter.


Provide endpoint name and select to configure multiple resources or verbs.(max11).


1st creating for addition operation.
Provide operation name, resouce uri: /addition, verb : post, and request and response payloads.


Provide json sample as request payload.


{
"Number1":"",
"Number2":""
}


Next


Provide json sample as response payload.


{
"Result":""
}


Next


Thus, we added 1st addition operation.
Select Add another operation box and go next


Add next operation : subtract.


Provide json sample for request payload.




Provide json sample for response payload.



Next


Thus we added 2 operations, we can add more (max 11) operations as required.

Next.


Done


We can see the operation flows added.


Do the Mappings for the addtion and subtraction operations .





Add the tracking from trigger >> more 





Save >> Activate >> Test




Thus, we can achieve the multiple resources or verbs on the rest adapters.


Wednesday, November 23, 2022

OIC - Subscribe to business events raised within the ERP Cloud

Here, we will show the subscription of the ERP Integration Inbound event which will be raised within ERP Cloud.

Detailed Steps:






Monday, November 21, 2022

OIC to ERP Cloud : what happens in the background ERP after import from OIC

Suppose we import AP invoice to ERP cloud from OIC using FBDI bulk import and ErpIntegrationService, then what happens do we really think?

If you dont know, just see the below processes which are running in the Scheduled process section in ERP:

Load Interface File for Import:
Interface loader will start and run InterfaceLoaderAsyncJob.

** Reading properties from scheduler environment Properties file.
/u01/APPLTOP/instance/ess/config/environmen.properties.

Transfer File: 
This above async job will submit loader job: InterfaceLoaderSqlldrImport to transfer the imported Header and Line files from UCM to respective Interface tables.
Load File to interface:
1st load header file : ApInvoicesInterface.csv to AP_INVOICES_INTERFACE table)
Load File to interface:
2nd load Line file : ApInvoiceLinesInterface.csv to AP_INVOICES_LINES_INTERFACE table.
Import Payables Invoices:
This will import the invoice data from inteface table to main import tables.
Import Payable Invoices Report:
This will generate report how the import goes, Is there any failure or what are the invoices processed or success details etc.

Product interface and error table data will be automatically be purged by the purge interfavw table scheduled procrss( default setting is within 30 days of the initial load). Prior to purge execution, the interface and error data will first be extracted and uploaded to the particular UCM server account for the individual product import process that is used. 

If you need to reference the purged interface and error data, then you will need to access the UCM file with the following naming convention:.
ImportBulkData_APXIIMPT_<LoadRequestId>.zip




Thursday, November 10, 2022

ODI12C - Why the Set variable increment parameter is disabled in package?

This is a common issue we observed in ODI. To increment the value of a variable in package, variable's data type must be numeric otherwise the increment option will be disabled.



Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...