Saturday, September 14, 2013

Subtracting Times in OSB using XQuery expression

If there is a need to calculate the Round Trip time of incoming and outgoing message in a Proxy Service of OSB we have an approach.

To subtract times you can use op:subtract-times() xquery function in OSB.

Example:

assing fn:current-time() to variable requestInTime.

Now to calculate the round trip time you can do the following in which we use the $requestInTime variable.

fn:substring-before(fn:substring(string(op:subtract-times(fn:current-time(),xs:time($requestInTime))), 3),'S')

Use above function in XQUERY expression in required action like assign, insert,replace.

Here, I've done some amount of formatting based on my requirement.
Essentially we need to use the op:subtract-times() function.

Hope this helps when you have a situation.

No comments:

Post a Comment