Search code examples
xquerymarklogicmarklogic-10

Call java function using XQuery in MarkLogic


Is it possible to call java function using XQuery in MarkLogic. ?

Please refer - https://stackoverflow.com/questions/65953901/calling-java-method-from-xquery

Example -

declare namespace math="java:java.lang.Math";
math:sqrt(2)

Solution

  • There's no way to directly call a Java function from MarkLogic XQuery. If the Java code is accessible through a web service, you can use xdmp:http-get and similar.

    As noted by Martin, depending on what functionality you're trying to access, you might not need to use Java.