Wednesday, July 28, 2021

OIC - callback action

Callback action used to end a process and return to the trigger. 

For instance, if you add a switch activity and define a branch in which you add a callback. If some defined logic is not met, then it moves to this branch and the integration is stopped and the trigger receives a response indicating that the integration is stopped here. 

This action is only valid for delayed or asynchronous integrations.


Lets have a small POC and see:


TBD


OIC - SFTP operations - Move and delete

Generally OIC supports following  5 Ftp operations:

  • Read a file
  • Write a file
  • List Files
  • Delete a file
  • Download a file
Here, I will show you the steps for a POC for move and delete operation.

Steps:

Step1: create an app driven or any other integration and create a rest trigger connection and drag and drop in the integration and configure the following:

Provide a endpoint name
Verb as POST
URI: /
Configure the request payload option

Request payload as Json:

{
"sourceDirectory": "sourceDirectory",
"fileName":"sourceFileName",
"targetDirectory":"target",
"targetFileName":"targetFile",
"moveFileFlag":"Y",
"deleteFileFlag" : "Y"
}

Step2: Take a switch acrivity and mention the condition moveFileFlag="Y" and take a SFTP connection and config the following:

Provide endpoint name: moveFile
Operation: Move a file
Overwrite file option checked.
Next
Done

Map the following :

directory: your source direcrory
fileName: file name
targetDirectory
targetFilename:

Step3: now take again a switch and mention the condition as deleteFileFlag=Y and drop a ftp connection and configure the following:

Provide endpoint name:

Operation : delete a file

Next

Done

Map the following:

directory:

fileName:

Step4: add the tracking, save and activate amd test it with proper data.

Monday, July 26, 2021

OIC - invoke BI control report and store in s3 bucket using rest connection.

Requirement:

Once the inbound file like policy, sub ledger or FAH processed to Oracle ERP, we get a IMPORT REQUEST ID. Based on the import id, we have to fetch the control file details and save it as text file to s3 bucket.

High level Solution steps:

  • Create BI report invoke soap connection and aws S3 rest connection.
  • Invoke the BI report for the control file
  • Decode the response to base64 reference 
  • Take an amazone s3 rest connection and configure to store the  control response to s3.

Detailed Implementation steps:

Create BI report invoke soap connection:

Here we will configure  " ExternalReprtWSSService WSDL URL " which can be used to run a report. The same connection we will use in below steps while developing integration.

  1. Navigate to connection window and select SOAP adapter, give any meaningful name for connection.
  2. Enter the ExternalReportWSSService WSDL URL  and Select the TLS Version. TLS Version depends on your ERP Cloud Application Instance. Mostly it is TLSv1.1WSDL URL Format : https://<your oracle cloud application instance domain>/xmlpserver/services/ExternalReportWSSService?WSDL
  3. Choose Security policy as Username Password token and Enter the *Username and *Password of the Oracle Cloud Application Instance. Click SAVE and TEST the Connection.
Create AWS s3 rest invoke connection:

create a rest S3 connection using  following details:

Connection type: Rest api base url.
Connection URL: https://hostname
Security:  AWS Signature version 4 
Provide access key, secret key, 
AWS region:  like US West(Oregon) Region (us-west-2) 
Service Name: Amazon S3.

Invoke BI report :

Step1: Create a schedule orchestrated integration and specify a schedule parameter like importRequestID.

Step2: Next, drag and drop the BI report soap invoke connection and choose operation as runReport.

Step3: Next, open the mapper and map the following:

reportAbsolutePath: 
sizeOfDataChunkDownload: -1
ParameterNamesValues:
name : "P_IMPORT_REQUEST_ID"
values item: importRequestID.




Decode BI report response to base64 reference:

decodeBase64ToReference(reportBytes)

Invoke AWS s3 rest connection and configure:

Step1: Drag and drop your created AWS s3 rest connection and configure the following:

provide relative url as /{pathAndFileName}, 
verb put ,  
provide request payload as Binary and choose other media type and mention media type as "text/plain".

Step2: In the map, assign the following:

Template param: pathAndFilename : "/rootnode/inbound/poc/ctrl.txt"
Stream reference :  Base64 reference


Thursday, July 22, 2021

OIC - substring a string using index-within-string() function.

Suppose we have a variable which contains a string like "a/b/c/d.txt;name=value" and we need to take the value before the searchstring(;) then that we can achieve following 2 ways:

1. Using substring-before():

substring-before($string,";")

2. Using substring() and index-within-string() functions;

substring($string,1,oraext:index-within-string($string,";")

This function(index-within-string()) returns the zero based index of the first occurance od search string within the input string. The function returns -1 if search string is not found.


OIC - Opaque schema for creating base64Binary file

Opaque_schema.xsd: this will be used in the stage write file adapter configuration.

<?xml version='1.0' encoding='UTF-8'?>

<schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/opaque/" xmlns="http://www.w3.org/2001/XMLSchema">

<element name="opaqueElement" type="base64Binary"/>

</schema>


Tuesday, July 20, 2021

OIC - Run a schedule integration now using rest api

Why to run schedule integration now:

  • Creates an ad-hoc integration run for a scheduled integration. This is useful when you want to test you schedule integration.

Relative URI: /ic/api/integration/v1/integrations/{id}/schedule/jobs/

Scenario1: we will create a schedule service accepting few parameters and then run it now from postman tool.

Implementation steps:

Step1: Create a schedule integration and mention the schedule parameters as required. Maximum you can define 5 parameters. Here I have mentioned following 3 params:

p_email : ""

p_fileName : ""

p_reportPath: ""

Step2: add a logger activity and concat 3 these params to show in log testing time. Add tracking and save and activate it.

Step3: open POSTMAN and provide the following details.

Verb : Post

URL: https://oic_instance_hostname:port/ic/api/integration/v1/integrations/{id}/schedule/jobs

Here Id: identifiername|version = POC19_scheduleintegrat|01.00.0000

| = %7C

In authrization tab, add basic authrization and provide username and password.

In Body tab, choose raw type and select JSON and provide the below payload:

{

"action":"NOW",

"parameters": [{

"name": "p_reportPath",

"value": "report_path"

},{

"name": "p_fileName",

"value": "put_filename"

},{

"name": "p_email",

"value": "provide_emailId"

}]

}


Or we can also use following:


{

"runAsSchedule" : false,

"parameters": [{

"name": "p_reportPath",

"value": "report_path"

},{

"name": "p_fileName",

"value": "put_filename"

},{

"name": "p_email",

"value": "provide_emailId"

}]

}

Note: If you mention runAsSchedule : true then the integration should have a active schedule in simple or ical. Otherwise it will fail with:

HTTP 412 Precondition failed.

Can not submit the run as part of the schedule because its not active.


Click on Send button and check from OIC monitoring and check activity stream and you will see the data in logger.


Scenario 2: we will create another intergration and from there we will run the schedule integration now.

Implementation steps:

Step1: Create a schedule integration and mention the schedule parameters as required. Maximum you can define 5 parameters. Here I have mentioned following 3 params:

p_email : ""

p_fileName : ""

p_reportPath: ""

Step2: add a logger activity and concat 3 these params to show in log testing time. Add tracking and save and activate it.

Step3: create a Rest_OIC_Invoke connection with below details:

Role: Trigger and Invoke

Connection Type: Rest API Base URL

Connection URL: https://your_oic_instance_hostname/

Security: Basic Authetication and provide Username and Password.

And test and save it.

Step4: create an app driven integration and choose the created rest connection as trigger point and provide following details:

Endpoint name: callSchedileInt and next

Verb : post

URI: /call

And as we are not passing any params here so not configuring anything just next and save.

Step5: drag and drop the rest connection as invoke point and provide following details:

Verb: post

Relative URI: /ic/api/integration/v1/integrations/{id}/schedule/jobs/

Add  select option -Configure a request payload for this endpoint.

Next

Next

In request section, choose jason sample and click inline and add the following payload:

{

"action":"NOW",

"Parameters": [{

"name": "p_email",

"value": "email"

},{

"name": "p_fileName",

"value": "put_filename"

},{

"name": "p_reportPath",

"value": "yourreportpath"

}]

}

Next

Done

Step6: go to the mapping part and map the following:

Id: POC19_scheduleintegrat|01.00.0000

Action: NOW

Repeat node for parameters 3 times for name value pair:

Name: p_email 

Value: "youremail"

Name: p_fileName

Value: "yourfilename"

Name: p_reportPath

Value: "yourreportpath"

Step7: add tracking and save and activate and test


You can also call schedule integration which does not have any schedule parameters for that you have to use below json payload:

payload:

{

"action":"NOW"

}


OIC - get ESS JOB Status of a ESS import job

Here, I will show you how to get the ESS job status once the import job completed and you have the ess import request id.

Logic: 

we will create a loop and check the ess job status using the import request id whether the ess import job is successful or not(at each loop it will wait 59 sec). 




Follow the below steps:

Step1: Take an assign activity named like setImportLoopVariable and assign the following 2 variables:

I_inProgress : "true"

I_importRequestStatus : ""

Step2: take a while activity and add the following condition.

$I_inProgress = "true"

Step3: Take a wait activity and assign some time to complete the import ESS process lika value 59sec.

Step4: Drag and drop Erp cloud adapter and configure following:

Provide a name: essJobStatus

Select Query, Create, Update or delete information.

Select service: ErpIntegrationService

Operation: getESSJobStatus

Step5: Map the ess import request id to request id of the getEssJobstatus.

Step6: Take a assign named like updateProgress and do the following:

I_inProgress : returnStatus(result of getESSJobStatusResponse)

I_importRequestStatus: result of getESSJobStatusResponse.


Click here how to convert the status to boolean value:

oic-js-return-boolean-status


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...