[英]RestXQ [XPTY0004] Cannot convert empty-sequence() to document-node()
我有一個RestXQ方法:
declare
%rest:path("/doSomething")
%rest:POST
%rest:form-param("name","{$name}")
function page:doSomething($name as document-node())
{
(: Code... :)
};
我試圖通過XForms向此方法發送POST請求。 作為對客戶端的響應,我得到[XPTY0004] Cannot convert empty-sequence() to document-node(): ().
我試圖刪除document-node()
但是參數$ name只是空的。
request參數如下所示:
<data xmlns=""><name>Test</name></data>
有什么辦法嗎?
問題是%rest:form-param("name","{$name}")
用於鍵-值對,但是您的方法表明您希望$name as document-node()
。 這兩件事加在一起是沒有意義的。
您可能需要使用POST請求的正文,而不是form-param
:
declare
%rest:path("/doSomething")
%rest:POST("{$body}")
function page:doSomething($body as document-node())
{
(: Code... :)
};
參見http://www.adamretter.org.uk/papers/restful-xquery_january-2012.xhtml#media-example
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.