Hi All,
I need to use the below XQuery custom function in SOA Composite Project in 12c, it works for SB projects but not for SOA composite projects as the DVM lookup function is not resolved inside the XQuery, possibly because it is only available for the XSLT? Please help if you can give a solution to this problem.
xquery version "1.0" encoding "utf-8";
(:: OracleAnnotationVersion "1.0" ::)
declare namespace ngssp1="http://inatooo.com/nesp";
declare variable $origin as xs:string external;
declare variable $txnStartDateTime as xs:dateTime external;
declare function ngssp1:getSLAStatus($origin as xs:string,
$txnStartDateTime as xs:dateTime)
as xs:string {
let $currentDateTime := fn:current-dateTime()
let $elapsedTimeDuration := $currentDateTime - $txnStartDateTime
let $elapsedTime := fn:seconds-from-duration($elapsedTimeDuration) * 1000
let $slaTime := dvmtr:lookupValue("DemoSOAApplication/DVM/SLAInfo", "channel", $origin, "sla", "3600000",("service_class","default"))
return
if (number($elapsedTime) >= number($slaTime)) then
fn:concat("SLA_FAIL: SLA WAS ",string($slaTime), " ELAPSED TIME: ", $elapsedTime)
else
fn:concat("SLA_OK: SLA WAS ",string($slaTime), " ELAPSED TIME: ", $elapsedTime)
};
ngssp1:getSLAStatus($origin, $txnStartDateTime)