Friday, August 11, 2023

OIC - Handling Custom SOAP Headers with XML Schema in Oracle Integration Cloud (OIC)

Usecase: 

In many SOAP-based integrations, the service provider requires additional WS-Addressing headers (such as Action and To) to be explicitly included in the SOAP request.

However, OIC does not always auto-generate these headers, and missing them can lead to authentication or routing errors.

The challenge:

SOAP web service expects custom WS-Addressing headers (Action, To).

OIC does not allow adding them directly in the standard mapper.

We need a way to inject these headers in the SOAP request payload dynamically.

The following highlighted Action and To headers need to pass:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005...>

<s:Header>

<a:Action s:mustUnderstand="1">http://www.testsoftwate.com/dataservices/bidata/2/testdataservice</a:Action>

<a:To s:mustUnderstand="1">http://www.servivehost/services/testdataservice</a:To>

</s:Header>

<s:Body>

...

</s:Body>

</s:Envelope>

Solution

We solve this problem by defining a custom XML schema for the required headers and attaching it to the SOAP Header section in OIC.

Implementation Steps:

Step1: Create header schema for the custom SOAP headers as below:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:wsa="http://www.w3.org/2005/08/addressing"
           targetNamespace="http://www.w3.org/2005/08/addressing"
           xmlns="http://www.w3.org/2005/08/addressing"
           elementFormDefault="qualified">

    <xs:element name="Action" type="xs:string"/>
    <xs:element name="To" type="xs:string"/>
</xs:schema>

Step2: save this as ActionHeader.xsd and checked the custom header option for request and upload the file to invoke configure adapter.

Note: For each element in the SOAP header, the schema must be imported separately. In this case, since we have two elements (Action and To), the schema needs to be imported twice, and each element has to be selected individually.



Step3: Map the Header value in the mapper.

No comments:

Post a Comment

Featured Post

OIC - OIC Utility to Reprocess Failed Real-Time Integration JSON Payloads

📌 Use Case In real-time OIC integrations, JSON payloads are exchanged with external systems via REST APIs. When such integrations fail (du...