Marklogic 我在处理ZIP时收到500个内部服务器错误(XDMP-CHILDNODEKIND)

Marklogic 我在处理ZIP时收到500个内部服务器错误(XDMP-CHILDNODEKIND),marklogic,marklogic-10,Marklogic,Marklogic 10,我们有rest扩展,post方法的参数之一是我们想要处理的zip,但我得到了错误500。以下消息显示响应。ZIP由一些json、图像和pdf组成。是否有任何解决方法使其运行 以下是我在PROD环境中得到的情况: 分机代码: declare %roxy:params("") %rapi:transaction-mode("update") function dmc:post( $context as map:map, $params as map:map, $input

我们有rest扩展,post方法的参数之一是我们想要处理的zip,但我得到了错误500。以下消息显示响应。ZIP由一些json、图像和pdf组成。是否有任何解决方法使其运行

以下是我在PROD环境中得到的情况:

分机代码:

declare 
%roxy:params("")
%rapi:transaction-mode("update")
function dmc:post(
    $context as map:map,
    $params  as map:map,
    $input   as document-node()*
) as document-node()*
{
  let $_ := xdmp:log("**********")
  let $_ := xdmp:log($context)
  let $_ := xdmp:log("**********")

  let $_ := xdmp:log("**********")
  let $_ := xdmp:log($params)
  let $_ := xdmp:log("**********")

  let $_ := xdmp:log("**********")
  let $_ := xdmp:log($input)
  let $_ := xdmp:log("**********")

  let $_ := xdmp:log("**********")
  let $_ := xdmp:log(xdmp:get-request-field-content-type("rs:file"))
  let $_ := xdmp:log("**********")

  let $_ := map:put($context, "output-types", "application/xml")
  let $_ := map:put($context, "output-status", (201, "Created"))
  let $name := map:get($params, "name")
  let $file := map:get($params, "file")
  return document{c:my-function($name, $file)}
};
模块代码:

declare function c:my-function($name as xs:string, $file as binary()) as xs:string{

    let $my-name := $name
    let $my-file := $file
    return $my-name
};
错误日志:

2020-02-20 20:57:04.530 Info: **********
2020-02-20 20:57:04.530 Info: {"input-types":"multipart/form-data"}
2020-02-20 20:57:04.530 Info: **********
2020-02-20 20:57:04.530 Info: **********
2020-02-20 20:57:04.531 Info: {"file":["", "504b0304140000000800339fa94a56184dfee3850000209000001a00000000a882994a20b6abbe41000000410000000a00000000000000010020000000a38e0000617373656c2e6a736f6e504b05060000000003000300b90000000c8f00000000"], "name":"shrikant"}
2020-02-20 20:57:04.531 Info: **********
2020-02-20 20:57:04.531 Info: **********
2020-02-20 20:57:04.531 Info: **********
2020-02-20 20:57:04.531 Info: **********
2020-02-20 20:57:04.531 Info: application/x-zip-compressed
2020-02-20 20:57:04.531 Info: **********
2020-02-20 20:57:04.537 Notice: XDMP-AS: (err:XPTY0004) $file as binary() -- Invalid coercion: "" as binary()
2020-02-20 20:57:04.537 Notice:+in /config/config.xqy, at 21:60,
2020-02-20 20:57:04.537 Notice:+in xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/MyExtension","post"), "/marklogic.rest.resource/MyExtension/assets/resource.xqy")(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...), document{binary{""}}) [1.0-ml]
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 905:44,
2020-02-20 20:57:04.537 Notice:+in extut:call-service("MyExtension", "POST", xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/MyExtension","post"), "/marklogic.rest.resource/MyExtension/assets/resource.xqy"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...), document{binary{""}}) [1.0-ml]
2020-02-20 20:57:04.537 Notice:+  $extension-name = "MyExtension"
2020-02-20 20:57:04.537 Notice:+  $method = "POST"
2020-02-20 20:57:04.537 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/MyExtension","post"), "/marklogic.rest.resource/MyExtension/assets/resource.xqy")
2020-02-20 20:57:04.537 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2020-02-20 20:57:04.537 Notice:+  $service-params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...)
2020-02-20 20:57:04.537 Notice:+  $input = document{binary{""}}
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 858:20,
2020-02-20 20:57:04.537 Notice:+in function() as item()*() [1.0-ml]
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy,
2020-02-20 20:57:04.537 Notice:+in xdmp:invoke(function() as item()*, <options xmlns="xdmp:eval"><isolation>different-transaction</isolation>...</options>) [1.0-ml]
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/lib/extensions-util.xqy, at 856:12,
2020-02-20 20:57:04.537 Notice:+in extut:invoke-service("MyExtension", "POST", "query", xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/MyExtension","post"), "/marklogic.rest.resource/MyExtension/assets/resource.xqy"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...), document{binary{""}}, fn:false()) [1.0-ml]
2020-02-20 20:57:04.537 Notice:+  $extension-name = "MyExtension"
2020-02-20 20:57:04.537 Notice:+  $method = "POST"
2020-02-20 20:57:04.537 Notice:+  $default-txn-mode = "query"
2020-02-20 20:57:04.537 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/MyExtension","post"), "/marklogic.rest.resource/MyExtension/assets/resource.xqy")
2020-02-20 20:57:04.537 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2020-02-20 20:57:04.537 Notice:+  $service-params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...)
2020-02-20 20:57:04.537 Notice:+  $input = document{binary{""}}
2020-02-20 20:57:04.537 Notice:+  $in-txn = fn:false()
2020-02-20 20:57:04.537 Notice:+  $txn-curr = "query"
2020-02-20 20:57:04.537 Notice:+  $txn-mode = "update"
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/models/resource-model-query.xqy, at 269:20,
2020-02-20 20:57:04.537 Notice:+in rsrcmodqry:resource-post("MyExtension", map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...), document{binary{""}}, fn:false(), local:rsrcmod-callback#6) [1.0-ml]
2020-02-20 20:57:04.537 Notice:+  $resource-name = "MyExtension"
2020-02-20 20:57:04.537 Notice:+  $context = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2020-02-20 20:57:04.537 Notice:+  $resource-params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...)
2020-02-20 20:57:04.537 Notice:+  $input = document{binary{""}}
2020-02-20 20:57:04.537 Notice:+  $in-txn = fn:false()
2020-02-20 20:57:04.537 Notice:+  $responder = local:rsrcmod-callback#6
2020-02-20 20:57:04.537 Notice:+  $service = xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/MyExtension","post"), "/marklogic.rest.resource/MyExtension/assets/resource.xqy")
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/models/resource-model-query.xqy, at 236:4,
2020-02-20 20:57:04.537 Notice:+in rsrcmodqry:exec-post(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...), document{binary{""}}, local:rsrcmod-callback#6) [1.0-ml]
2020-02-20 20:57:04.537 Notice:+  $headers = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2020-02-20 20:57:04.537 Notice:+  $endpoint-params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...)
2020-02-20 20:57:04.537 Notice:+  $input = document{binary{""}}
2020-02-20 20:57:04.537 Notice:+  $responder = local:rsrcmod-callback#6
2020-02-20 20:57:04.537 Notice:+in /MarkLogic/rest-api/endpoints/resource-service-query.xqy, at 78:8 [1.0-ml]
2020-02-20 20:57:04.537 Notice:+  $headers = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>)
2020-02-20 20:57:04.537 Notice:+  $method = "POST"
2020-02-20 20:57:04.537 Notice:+  $body = document{binary{""}}
2020-02-20 20:57:04.537 Notice:+  $params = map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-CHILDNODEKIND: element nodes cannot have binary node children...)
2020-02-20 20:57:04.537 Notice:+  $extra-names = ()
2020-02-20 20:57:04.542 Info: Status 500: XDMP-AS: (err:XPTY0004) $file as binary() -- Invalid coercion: "" as binary()
2020-02-20 20:57:04.530信息:**********
2020-02-20 20:57:04.530信息:{“输入类型”:“多部分/表单数据”}
2020-02-20 20:57:04.530信息:**********
2020-02-20 20:57:04.530信息:**********
2020-02-20 20:57:04.531信息:{“文件”:[,“504B30414000000080039FA94A56184DFEE3850000209000001A00000000A882994A20B6ABBEB41000004100000000A00000000010020000000A38E0000617373656C2E6A736F6E504B05000000000300300B900000C8F00000000],“名称”:“shrikant”}
2020-02-20 20:57:04.531信息:**********
2020-02-20 20:57:04.531信息:**********
2020-02-20 20:57:04.531信息:**********
2020-02-20 20:57:04.531信息:**********
2020-02-20 20:57:04.531信息:应用程序/x-zip-compressed
2020-02-20 20:57:04.531信息:**********
2020-02-20 20:57:04.537注意:XDMP-AS:(错误:XPTY0004)$file AS binary()--强制无效:“”AS binary()
2020-02-20 20:57:04.537通知:+in/config/config.xqy,21:60,
2020-02-20 20:57:04.537通知:+in-xdmp:function(fn:QName(“http://marklogic.com/rest-api/resource/MyExtension“,“post”),“/marklogic.rest.resource/MyExtension/assets/resource.xqy”)(map:map(),map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…),文档{binary{”“})[1.0-ml]
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/lib/extensions-util.xqy,905:44,
2020-02-20 20:57:04.537通知:+在extut中:调用服务(“MyExtension”,“POST”,xdmp:functionhttp://marklogic.com/rest-api/resource/MyExtension“,“post”),“/marklogic.rest.resource/MyExtension/assets/resource.xqy”),map:map(),map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…,文档{binary{”“})[1.0-ml]
2020-02-20 20:57:04.537通知:+$extension name=“MyExtension”
2020-02-20 20:57:04.537通知:+$method=“POST”
2020-02-20 20:57:04.537注意:+$service=xdmp:functionhttp://marklogic.com/rest-api/resource/MyExtension“,“post”),“/marklogic.rest.resource/MyExtension/assets/resource.xqy”)
2020-02-20 20:57:04.537注意:+$context=map:map()
2020-02-20 20:57:04.537注意:+$service params=map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…)
2020-02-20 20:57:04.537注意:+$input=document{binary{”“}
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/lib/extensions-util.xqy,858:20,
2020-02-20 20:57:04.537通知:+in function()as item()*()[1.0-ml]
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/lib/extensions-util.xqy,
2020-02-20 20:57:04.537注意:+in-xdmp:invoke(函数()作为项()*,不同的事务…[1.0-ml]
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/lib/extensions-util.xqy,856:12,
2020-02-20 20:57:04.537注意:+in-extut:invoke服务(“MyExtension”、“POST”、“query”),xdmp:function(fn:QName(“http://marklogic.com/rest-api/resource/MyExtension“,“post”),“/marklogic.rest.resource/MyExtension/assets/resource.xqy”),map:map(),map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…),文档{binary{”“},fn:false())[1.0-ml]
2020-02-20 20:57:04.537通知:+$extension name=“MyExtension”
2020-02-20 20:57:04.537通知:+$method=“POST”
2020-02-20 20:57:04.537通知:+$default txn mode=“query”
2020-02-20 20:57:04.537注意:+$service=xdmp:functionhttp://marklogic.com/rest-api/resource/MyExtension“,“post”),“/marklogic.rest.resource/MyExtension/assets/resource.xqy”)
2020-02-20 20:57:04.537注意:+$context=map:map()
2020-02-20 20:57:04.537注意:+$service params=map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…)
2020-02-20 20:57:04.537注意:+$input=document{binary{”“}
2020-02-20 20:57:04.537通知:+$in txn=fn:false()
2020-02-20 20:57:04.537通知:+$txn curr=“查询”
2020-02-20 20:57:04.537通知:+$txn mode=“更新”
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/models/resource-model-query.xqy,269:20,
2020-02-20 20:57:04.537注意:+in-rsrcmodqry:resource post(“MyExtension”,map:map(),map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…),document{binary{“”},fn:false(),local:rsrcmod回调#6)[1.0-ml]
2020-02-20 20:57:04.537通知:+$resource name=“MyExtension”
2020-02-20 20:57:04.537注意:+$context=map:map()
2020-02-20 20:57:04.537注意:+$resource params=map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…)
2020-02-20 20:57:04.537注意:+$input=document{binary{”“}
2020-02-20 20:57:04.537通知:+$in txn=fn:false()
2020-02-20 20:57:04.537通知:+$responder=local:rsrcmod callback#6
2020-02-20 20:57:04.537注意:+$service=xdmp:functionhttp://marklogic.com/rest-api/resource/MyExtension“,“post”),“/marklogic.rest.resource/MyExtension/assets/resource.xqy”)
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/models/resource-model-query.xqy,236:4,
2020-02-20 20:57:04.537注意:+in-rsrcmodqry:exec post(map:map(),map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…),document{binary{“”},local:rsrcmod callback#6)[1.0-ml]
2020-02-20 20:57:04.537注意:+$headers=map:map()
2020-02-20 20:57:04.537注意:+$endpoint params=map:map(…XDMP-CHILDNODEKIND:element节点不能有二进制节点子节点…)
2020-02-20 20:57:04.537注意:+$input=document{binary{”“}
2020-02-20 20:57:04.537通知:+$responder=local:rsrcmod callback#6
2020-02-20 20:57:04.537通知:+in/MarkLogic/restapi/endpoints/resource-service-query.xqy,78:8[1.0-ml]
20