Tuesday, September 7, 2021

OIC - Convert JSON to String

Use Case: Sometimes we come to situation where we get a source json file from source system and may need to send  the json as string to target system.

Source Json:

{

"firstname": "srinanda",

"lastname":"das"

}

Target Json as string:

{

"data": "{\n  \"firstname\" : \"srinanda\",\n  \"lastname\" : \"das\'\n}"

}

Opaque.xsd:

<?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>


Implementation steps:,

Step1:  Rest trigger configure with request and response




Step2: Write a JSON file with the inputs using Stage file.




Sample.json contains:


Step3: Map the inputs to Write fields.


Step4: Read the files to opaque using Stage file.



Opaque.xsd


Map the read opaque reference to data response with decodebase64().


The flow is like below:


Test:



No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...