Convert JSON to String Oracle Integration
I have seen multiple target applications which accept the JSON data as a String in a single element. So, it is necessary to convert the JSON to String before you call the target endpoint.
For example:
Below is the JSON which you may get from the source system:
{
"firstname": "ankur",
"lastname": "jain"
}
and you need to map the above JSON as a string in the following single element:
{
"data" : "{\n \"firstname\" : \"ankur\",\n \"lastname\" : \"jain\"\n}"
}
So, in order to achieve this, first, you have to write the JSON to the temporary location using the Stage File action and read it using the opaque schema as a String.
Here is the opaque.xsd code which you need to use to read the JSON from the stage:
<?xml version = '1.0' encoding = 'UTF-8'?>
<schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/opaque/"
xmlns="http://www.w3.org/2001/XMLSchema" >
<element name="opaqueElement" type="base64Binary" />
</schema>
I have captured a short video to showcase how to convert the JSON to String in Oracle Integration. Click on the below link to watch the video.
Subscribe to my YouTube channel to get regular updates.
View more interesting posts
Business Rules in Visual Builder Cloud Service
Provisioning Oracle Visual Builder Cloud Instance