X

The Integration blog covers the latest in product updates, best practices, customer stories, and more.

Use Global Variables and Data Stitch to log request payloads

Thomas Hora
Senior Director of Development

In this blog, we will look at 2 new Integration features Global Variables, and Data Stitch.  Data Stitch allows us to make assignments to complex type variables.  We will show how the features can be leveraged to log invoke request payloads in case of fault.

Prerequisite

Enable following features:

  • oic.ics.console.integration.stitch-action
  • oic.ics.console.integration.complex-variables

To enable feature flags – Refer to Blog Enabling Feature Flags in Oracle Integration

The minimum Oracle Integration version required for the feature is 200113.1400.33493

Use case: 

When invoke fails, we want to log the request payload.  Currently, request payloads are visible after the invoke, but not visible inside the fault handlers.

Solution:

We will create a Global Variable based on the request payload.  Global Variables are visible anywhere in the integration, including fault handlers.

Click on the (X) icon on the right-hand toolbar to access Global Variables.  

Give the global variable a name.  For type, select Object, indicating a complex type.

Selecting Object opens the schema tree.  There, select an appropriate element, indicating our global variable will inherit this element’s type.

Next, we will use Data Stitch to assign a value to this variable.

Add Data Stitch action prior to the invoke to copy the request payload to the Global Variable.

Name the Data Stitch action and click configure.

In the Variable field (To), type “payload” to use the quick search to find and select the previously created Global Variable.

Or, click Browse All Data to open the schema tree.  Under sources, drag and drop the Global Variable root element into the Variable field.

With the Variable field populated, the Operation field defaults to Assign, and the Value field appears. 

Accept the Operation field default as Assign. 

In the Value field (From), use the schema tree to select the desired request payload.

Optionally, we can click on the tool icon to the right to toggle the Variable and Value fields into developer mode to look at the full xpath expression.

We have completed this Stitch action.  Click “X” to close the editor and apply changes. 

Next, we will create the logger action to log the Global Variable in the fault handler.

Go to the appropriate fault handler for the invoke.

Add logger action.

In the Logger editor, the Global Variable will be shown as an available source. Drag and drop it into the expression.  Make sure to also use an appropriate function such as getContentAsString in order to print the text properly.

Save and activate the integration.   Test it against an invoke failure scenario, and you will see the request payload in the ics-flow.log:

Example:

[2020-03-09T21:05:15.982-07:00] [integration_server1] [NOTIFICATION] [] [oracle.ics.trace.soa.bpel] [tid: 154] [userId: icsadmin] [ecid: 8b44b372-eefe-4f03-ae9f-ecea6d4d020d-000ee5c4,0] [APP: soa-infra] [partition-name: DOMAIN] [tenant-name: GLOBAL] [FlowId: 0000N32bZJS9d_HpIsT4if1ULFFC0002bU]  [ICS User Logging]: [Code:CREA_ORDE_BY_REGI_STIT_LOG_PAYL][Version:01.00.0000][Instance:21][Operation:Logger][ActionID:lg0][ActionName:logPayload]: <Account xmlns="http://xmlns.stark.com"><ns23:AccountDetails xmlns:ns23="http://xmlns.stark.com"><ns23:ExternalSystemId>a</ns23:ExternalSystemId><ns23:SystemRowId>a</ns23:SystemRowId><ns23:ExternalSourceSystem>a</ns23:ExternalSourceSystem><ns23:AccountStatus>a</ns23:AccountStatus><ns23:AccountStatusChangeReason>a</ns23:AccountStatusChangeReason><ns23:AccountTypeCode>a</ns23:AccountTypeCode><ns23:AccountNumber>a</ns23:AccountNumber><ns23:ContactId>a</ns23:ContactId><ns23:CurrencyCode>a</ns23:CurrencyCode><ns23:PrimaryOrganization>APAC</ns23:PrimaryOrganization></ns23:AccountDetails></Account>

Congratulations, we have just used Global Variable and Data Stitch to log payloads in case of fault!

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.