http post-SVC-UTF8SEQ-无效的UTF-8转义序列:0xf4 0x74



我使用ML版本10.0-7.3当主机未知时,http post返回有问题。我试图抓住错误,但这是不可能的。这是一个非常精简的代码:

xquery version "1.0-ml";
let $return := try {xdmp:http-post("http://toto/titi")} catch ($e) { $e}
return $return

控制台中的结果是:

*[1.0-ml] SVC-UTF8SEQ: let $return := try { xdmp:http-post("http://toto/titi") } catch ($e) { $e } return $return -- Invalid UTF-8 escape sequence: 0xf4 0x74
Stack Trace
At line 4 column 0:
In xdmp:eval("xquery version &quot;1.0-ml&quot;;&#10;&#10;&#10;let $return := ...", (), <options xmlns="xdmp:eval"><database>17567623539722960267</database>...</options>)
2.
3.
4. l et $return := try {
5. xdmp:http-post("http://toto/titi")}
6. catch ($e)* 

可能是对xdmp:http-post()进行了延迟求值,只有在取消引用$return变量时才能解析。

  • https://www.marklogic.com/blog/lazy-evaluation/
  • https://www.marklogic.com/blog/lazy-vs-eager-evaluation/

尝试使用xdmp:eager()

xquery version "1.0-ml";
let $return := try { xdmp:eager(xdmp:http-post("http://toto/titi")) } catch ($e) { $e}
return $return

或者移动try{}内部的所有内容

我在centos上尝试了10.0-8.2版本,捕获结果可以,响应:

<response xmlns="xdmp:http">
<code>404
</code>
<message>Not Found
</message>
<headers>
<server>nginx/1.14.1
</server>
<date>Mon, 17 Jan 2022 13:07:47 GMT
</date>
<content-type>text/html
</content-type>
<content-length>3971
</content-length>
<connection>keep-alive
</connection>
<etag>"5d9bab28-f83"
</etag>
</headers>
</response>

最新更新