java - Marklogic 6 , java调用资源扩展

标签 java xquery marklogic

我需要将 xquery 模块上传并使用到 ma​​rklogic 6,例如 check-docAvailable.xqy。我尝试使用 ML6 给出的 dictionary.xqy 示例,它运行良好。但是当我尝试导入我自己的 xquery 时,我遇到了以下错误。

ERROR :
Exception in thread "main" com.marklogic.client.FailedRequestException: Local message: config/resources write failed: Internal Server Error. Server Message: XDMP-IMPORTMOD: Cannot import Main Module /marklogic.rest.resource/dictionary/lib/resource.xqy.  See the MarkLogic server error log for further detail.
    at com.marklogic.client.impl.JerseyServices.putPostValueImpl(JerseyServices.java:2033)
    at com.marklogic.client.impl.JerseyServices.putValue(JerseyServices.java:1918)
    at com.marklogic.client.impl.ResourceExtensionsImpl.writeServices(ResourceExtensionsImpl.java:114)
    at com.mobius.ln.ml.util.MLUtil$DictionaryManager.installResourceExtensionShortcut(MLUtil.java:279)
    at com.mobius.ln.ml.util.MLUtil.main(MLUtil.java:202)

我的 Xquery 模块:

xquery version "1.0-ml";
declare namespace xs = "http://www.w3.org/2001/XMLSchema";
declare variable $uri as xs:string external;

let $uri := $uri
return (
fn:doc-available($uri)
)

请建议我如何实现这一点。 Xquery有没有错误?

最佳答案

我建议通读 Extending the REST API .您的 XQuery 模块看起来不像 REST 扩展。当我尝试通过 curl 安装你的模块时

curl --anyauth --user admin:admin -i \
  -H "Content-type: application/xquery" \
  --data-binary @/c/temp/a.xqy \
  -X PUT http://localhost:8000/LATEST/config/resources/a

我收到以下错误:

{"errorResponse":{"statusCode":400, "status":"Bad Request", "messageCode":"RESTAPI-INVALIDCONTENT", "message":"RESTAPI-INVALIDCONTENT: (err:FOER0000) 无效内容:无效的扩展:无法解析 XQuery 扩展 a;请参阅服务器错误日志了解详细信息或不在 http://marklogic.com/rest-api/resource/a 命名空间中提供扩展功能(删除、获取、放置、发布)"}}

关于java - Marklogic 6 , java调用资源扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36428569/

相关文章:

xml - id 函数和无效 xml 的不同结果 :id attribute

xquery - 使用 mlcp、csv 文件和转换解析日期导入数据

marklogic - 无法找到 xdmp :plan result documentation

java - 如何让简单的 DAG 在 Hazelcast Jet 中工作?

java - Java 中的开源图像倾斜检测/校正库?

xquery - MarkLogic 光学 API : Filtering rows with op:where() with timestamps older than 30 days

c# - 从 XHTML 文档中去除特定标签(但保留其内容)的机制?

xquery - 使用 Xquery 在 Marklogic 中实现信封模式?

java - 无法在eclipse中正确添加API

java - 可以在 java 1.4 中使用 JXLS 吗?