简体   繁体   中英

How do I get the HTTP POST body in MarkLogic XQuery?

I'm trying to use the exist-db request:get-data() method to get the post data of a request. However, I'm getting the error:

XDMP-UNDFUN: (err:XPST0017) Undefined function request:get-data()

I did declare the namespace in my header. I don't understand why I still can't use request:get-data() or any of the other request: functions

declare namespace request="http://exist-db.org/xquery/request";
declare option exist:serialize "method=xml media-type=text/xml indent=yes";

let $post-data := request:get-data()
return $post-data

我想你正在寻找xdmp:get-request-body

Sam pointed you to the function you need, but I wanted to respond to another part of your question:

I did declare the namespace in my header. I don't understand why I still can't use request:get-data() or any of the other request: functions

Each XQuery processing engine implements standard functions , but there is other functionality needed that is not defined by the standard. For MarkLogic, you'll use standard functions with the fn: prefix.

Each XQuery engine then defines additional functions that will be needed. For Exist DB, some of those are in the " http://exist-db.org/xquery/request " namespace, while MarkLogic uses " http://marklogic.com/xdmp " for a lot of its extension functions.

When you're looking for the MarkLogic equivalent of an Exist DB-specific function, search on http://docs.marklogic.com -- start with the function name, and if that doesn't work, search for the terms that describe what you're trying to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM