Wednesday, January 13, 2021

#825 Guest Post - OIC --> JSON Obfuscation

 This is my first guest post and it couldn't come from a more competent source - so take it away Chris Peytier -

With Oracle Integration Cloud, the need to handle incoming JSON requests is rather common,

However, OIC will attempt to process these request, and will hence not maintain the original JSON format. What if we want to handle the request "as is", preserving its original structure? For example if we want to pass it down to, say, an ADW database instance, so that it can be processed there as JSON document? How can we avoid OIC to interpret and "de-structure" the JSON formatting? 

 

We can do this by using an "obfuscated" mode, In order to preserve the JSON structure of an incoming request.  For this, we will write & read the file with 2 stage file actions in sequence.

Here are the steps that need to be performed:

a)     Write your incoming JSON request into a file, via a Stage File action:


 






You can choose the name of the directory, etc. as you wish.

b) Create a file on your laptop , of type .xsd, for example opaqueSchema.xsd, and enter the following lines in that file:





c) Create another Stage File action in order to read as "entire file", this time using the obfuscated mode.  In the "schema option", you will need to state that you want to specify the contents of the file, and chose "XML schema" as shown below







d) On the next screen , select the opaque_schema.xsd file which you have created on your laptop.







The summary of your ReadFileAsOpaque should look like this:














e) Finally, in the mapping section, you will need to use a decodeBase64 function . 
The output can be used to do whatever you want ( in my case, I was sending it to an ATP database).
The JSON object's format will have been preserved.





Chris Peytier January 2021

No comments: