In the previous post we have improved the solution allowing running SQL queries from VB AppUIs by utilizing BIP lexicals.
The solution was based on the following:
The last solution element relies on REST Web Service definition that points to an OIC instance. Such a connection should be updated after P2T process to ensure that no TEST instance will access PROD.
The new proposed solution utilizes the fa-internal.oracleoutsourcing.com hostname to call the BIP report above and return the generic response by groovy code only. No OIC involved.
Such a solution is completely hassle-free in P2T process as the logical name above is pointing to the current environment.
The solution below will explain how to setup the connection above, implement the groovy method and finally call it from Javascript chains in VBCS AppUIs.
def reportRequest =
[
byPassCache :true,
reportAbsolutePath :'/Custom/Integrations/Utils/RunSQLToJson.xdo',
sizeOfDataChunkDownload :-1,
attributeFormat: 'xml',
parameterNameValues:
[
item:
[[
name :'p_sql',
values:
[
item:
[[
item :sqlText,
]],
],
]],
],
];
def appParams = '';
def report = adf.webServices.LocalWssReport.runReport(reportRequest, appParams);
def repResult = decodeBase64(report.reportBytes.toString());
def json = '';
if (contains(repResult, '</JSON_DOC>')) {
json = substringAfter(repResult, '<JSON_DOC>');
json = substringBefore(json,'</JSON_DOC>');
}
if (json == '') return '[]'
return json.replaceAll("&", "&")
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll(""", "\"")
.replaceAll("'", "'")
