xdmp:get-request-body( [$format as xs:string?] ) as item()*
For PUT or DELETE requests, returns the body of the request. For POST requests, returns the body of the request if it is not of content-type application/x-www-form-urlencoded.
Returns the empty sequence if it is not called from an application server.
If the content-type of the POST body is application/x-www-form-urlencoded,
it is not available here, but instead is available in its decoded form
through xdmp:get-request-field-names()
and
xdmp:get-request-field()
.
If there is no content-type header in the request, then the request
body defaults to application/x-www-form-urlencoded, and therefore
xdmp:get-request-body
will return the empty sequence. If
you want to read the request body, then the POST must include a
content-type header.
You can use this function to process certain types of web service SOAP requests with MarkLogic Server.
The output of an xdmp:get-request-body
call is
typically a document node, so if you want to get the contents of
the POST, you should add a /node()
XPath step to
the output. The contents of the document node could be a text node,
an element node, or a binary node.
xdmp:get-request-body()/node() => "<a>Contents of POST body.</a>"