Saturday, December 14, 2024

OIC - Implementing Robust Error Handling with Backup Service and Custom Fault Response

Usecase:

Enhancing the API's resilience by introducing error handling to fall back to a backup service if the primary REST API for retrieving country details fails. Additionally, global fault handling will be implemented to deliver a custom fault response for consistent error messaging.

Primary service:

https://restcountries.com/v3.1/alpha/IND

Backup service:

https://api.worldbank.org/v2/country/IND?format=json

Logic steps:

  1. Create 2 Rest invoke connections for primary and backup services.
  2. Create a application integration and configure the trigger with
    1. Uri: /country/{code}
    2. Get operation
    3. Provide json response
  3. Configure Primary service Rest api
  4. Take a scope and keep the primary service inboke and map inside of it.
  5. Add scope fault handler and do the following
    1. Configure backup service
    2. Map the input code 
    3. Take a return action and map the details.
  6. Configure global fault
    1. Add  "throw new fault" action to send custom fault to OIC Error Hospital 
Trigger response:
{
    "name": "United States of America",
    "alpha2Code": "US",
    "alpha3Code": "USA",
    "capital": "Washington
}

Detailed screenshots:
































No comments:

Post a Comment

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