Sample REST Integration built to handle exceptions in OIC

When the integration service gives a call to transfer data from one system to another system, there is a high possibility of integration running into an erroneous state due to unknown errors. Therefore it becomes imperative to handle errors for the smooth run of integration services. 

In this article we will learn what are the different types of exception management are there in OIC and how we can use them


Use Case: New REST API will be created to insert data into On-Prem Database Instance. 


Create a New Integration, fill in the mandatory details as shown in the snippet



Drop the REST trigger to the pallette 




Fill in the mandatory details 



Select the operation as POST 





provide the sample JSON payload  request






provide the sample JSON payload  request response




Click on the Done button 




Now we will drop for a loop since we will go to insert multiple records into the on-premise database table through JSON Payload 



Provide the name for the For loop and also drop UserData array as a repeating element 




Now next step is to drop the scope

The scope can catch the error and move ahead to the next logical step in the integration. This does not stop the integration abruptly but rather moves to the next logical step(ex. if there is any Loop, loop will continue to execute)








Provide a name for the scope for example ExceptionScope as shown in the snippet





Drop On-Prem Database Connector within the scope, so whatever exception occurs it will catch it and proceed towards the next logical step. it is the same as Try/Catch block 




Configure On-Prem Database with SQL statements 


Provide the DML Statement the to insert data in the On-Prem database table and complete the rest of the steps 



Complete the mapping with request-response



Create mapping for response message as shown in the snippet 




Now next step is to catch the faults or Exceptions in OIC , we have to click on Fault Handler Exceptions

Click on Fault Handler 
Drop Throw New Fault

Provide errorCode, Reason, and Details 

Skip Condition if you want to move forward with the integration even though error occurs 



Here you can Fault Handler captured the exception as Agents were down




Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment

Popular posts from this blog

Sample HZ API's script to Create Contacts and Contact Points in Oracle

REST integration built-in OIC to read Large files with size more than 10MB