Wednesday, 5 December 2018

Change connection in the Integrations: Oracle Integration Cloud

There is the situation where we are required to replace the connection in the integrations. Integration cloud doesn't allow to change the connection from the integration canvas directly. So in this blog, we'll demonstrate two ways to solve this problem which will help us to easily switch the connection in the integrations.

Before we proceed further, let me explain the use case where we may require to change the connection in the integrations:
  • Let's suppose we have 10 integrations which are using the single DB connection and the name of the connection is DB_Conn. Considering, in the DB_Conn, we had configured the standard DB schema called apps. Later we realize the 5 integrations should not use standard schema to compile the package or procedures and should use some custom schema (custom_user). Then, in that case, we will have to create one more DB connection with the different name and configure custom_user and then use the DB connection in these 5 integrations.
  • We want to clone the integration and in the cloned integration wanted to use different connection
  • We are migrating the integration which uses one REST connection with name REST_Sample but we have REST connection on the different instance with a different name called REST_Conn
Below limitation need to keep in mind before we replace the connection
  • The integration should not be in locked or activate state
  • Only the connection of the same adapter type can be replaced. For example, if we have an integration using the REST adapter then we can't replace the connection of the SOAP adapter type.
There are two ways to replace the connection in the integrations.
  1. Export the integration and change the connection name in the project.xml file directly and then import
  2. Use Integration Cloud REST APIs to replace the connection
Let's get started and achieve both the ways to replace connection.

For this use case, we are considering below:
  • We have two connection of the REST adapter type with below names and having the role as the trigger
    • REST_Sample
    • REST_Conn
  • Created an integration with name Sample_Integration which initially uses the connection REST_Sample. You can see the connection name by hovering on the adapter

Approach-1 ) Export the integration, replace the connection name in the project.xml and then import back
  • Export the integration by clicking the hamburger menu parallel to the integration
  • Open the .iar file directly in the 7-zip
  • Navigate to the \icspackage\project\SAMPLE_INTEGRATION_01.00.0000\PROJECT-INF\ directory
  • Open the project.xml file and see the REST_SAMPLE. REST_SAMPLE is the REST adapter connection identifier
  • Replace the REST_SAMPLE with REST_CONN  which is another REST adapter connection identifier
  • Save the file and import the integration using the Import button
  • Hover the mouse over the connection and see the integration should show REST_Conn

Approach-2) Using Oracle Integration Cloud REST API
  • First, we will get the details of the Integration (Sample_Integration) using the GET REST API using POSTMAN tool
  • Notice the "dependencies" element in the response. It's showing the connection (REST_CONN) used in the Integration
  • Now, we'll use the update REST APIs to update the connection. Here we'll update the REST_CONN with REST_SAMPLE. Below are the details of update API
URL: /ic/api/integration/v1/integrations/{id}

Headers:

Authorization: Basic EncodeBase64({username}:{password})
X-HTTP-Method-Override: PATCH
Content-Type: application/json

HTTP Verb: POST

Body:

{
"dependencies": {
        "connections": [
            {
                "id": "REST_SAMPLE"
            }
        ]
    }
 }

  • Go back to the Integration list page,  hover the mouse over the connection and see the integration should the "REST_Sample" connection

No comments:

Post a Comment