In Oracle Integration Cloud (OIC), there are scenarios where the source system sends dynamic or variable JSON payloads through a REST service. Since the structure may change frequently, creating strict schemas becomes difficult.
In our requirement, the incoming JSON payload needs to be passed to the target Communication Cloud service as escaped JSON, while also reading only a few required fields from the payload for validations or processing.
Requirement
Expose a REST API in OIC.
Source system can send any type of JSON structure.
Need to avoid strict request schema dependency.
Read only required fields from the payload.
Pass the complete original JSON payload to Communication Cloud service as escaped JSON.
Solution Approach
1. Configure REST Trigger with Binary JSON Media Type
While creating the REST trigger:
Select Binary as the request payload type.
Set media type as:
Plain text
application/json
This allows OIC to accept any JSON structure dynamically without schema validation.
Benefit
No dependency on fixed JSON schema.
Supports variable or changing payload structures.
Prevents failures due to unexpected fields.
2. Read Required Fields Using Stage File Action
Since the payload is received as binary content:
Use Stage File → Read Entire File
Read the incoming payload as JSON.
From the Stage File schema, extract only the required fields needed for processing.
Example:
JSON
{
"employeeId": "1001",
"status": "ACTIVE",
"dynamicData": {
...
}
}
You may read only: employeeId , status without validating the complete payload structure.
3. Preserve Original JSON Payload
The key advantage of this approach is:
The original payload remains unchanged.
No need to reconstruct JSON again in mapper.
Entire payload can directly be forwarded to downstream systems.
4. Pass Complete Payload to Communication Cloud
The target Communication Cloud service expects escaped JSON.
Since the original payload is already preserved:
Map the complete payload directly to target request.
Use escaped JSON/string format as required by Communication Cloud API.
Example target payload:
JSON
{
"payload": "{\"employeeId\":\"1001\",\"status\":\"ACTIVE\"}"
}
Architecture Flow
Plain text
- Source System
↓
OIC REST Trigger
(Binary JSON Media Type)
↓
Stage File Read
(Read only required fields)
↓
Map Original Payload
↓
Communication Cloud REST Service
(Escaped JSON)
Advantages of This Approach
- Supports dynamic JSON structures.
- No schema maintenance effort.
- Avoids trigger regeneration issues.
- Easy handling of changing payloads.
- Efficient for pass-through integrations.
- Only required fields are parsed.
Conclusion
Using Binary JSON media type in OIC REST triggers is an effective solution when handling variable JSON payloads. By combining it with Stage File read operations, we can selectively access required fields while still forwarding the complete original payload to downstream systems like Communication Cloud without rebuilding the JSON structure.






No comments:
Post a Comment