I'm working on using an XQuery re-writer script to automate the login for a Single Sign-On solution. I'm starting with the Admin App Server at port 8001. In the App Server configuration I have:
Set authentication = application-level
Set url rewriter = rewriter.xqy
I have also set the following rewriter.xqy script at the root Admin/ directory on the server. As you can see, just as a simple test, I'm attempting to programmatically login as user "Austin" (a valid user).
xquery version "1.0-ml";
import module namespace rest = "http://marklogic.com/appservices/rest"
at "/MarkLogic/appservices/utils/rest.xqy";
import module namespace config = "http://marklogic.com/admin/endpoint-config"
at "/endpoints/config.xqy";
xdmp:login("Austin")
(rest:rewrite($config:OPTIONS,"uri"),xdmp:get-request-url())[1]
However, after recycling the webserver, I keep getting the following error when browsing to the Admin UI. As soon as I remove the xdmp line, the error goes away, and I can get straight in.
500: Internal Server Error XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected QName_ In /rewriter.xqy on line 9
As another test, I tried to log some messages using xdmp:log("test")
, but those lines are also failing.
Any clue why xdmp scripts are not running successfully?