0

我有一个 ESB 网络服务客户端,它使用以下 RestAPI 将文档上传到 Alfresco。

http://:8080/alfresco/service/api/upload

我理解,API 被称为多部分/表单数据,带有文件和必填字段。当我执行时,我得到了以下错误响应。

{
  "status": {
    "code": 400,
    "name": "Bad Request",
    "description": "Request sent by the client was syntactically incorrect."
  },
  "message": "Required parameters are missing",
  "exception": "",
  "callstack": [],
  "server": "Enterprise v5.2.3 (r852994b1-b12) schema 10,065",
  "time": "10-Jul-2020 12:26:47"
}

我使用 WSO2 ESB 客户端,ESB 代码看起来都不错。我唯一可以调试的地方是通过 wirelog 。Wirelog 显示一切都很好(请参阅下面的屏幕截图)。错误消息包含相互矛盾的信息,例如

"description": "客户端发送的请求语法错误。" "message": "缺少必需的参数",

有没有我可以从 Alfresco 服务器端获取的日志来确定问题的真正原因,哪个语法不正确?缺少什么参数?

电线日志的屏幕截图如下

请单击此链接以查看窃听器的图像

4

2 回答 2

0

您正在关注哪些文档?通过快速浏览这里,我会说您没有发送您应该发送的所有内容: https ://docs.alfresco.com/5.0/references/RESTful-UploadUploadPost.html

这是您看到的被触发的情况,因此我会更仔细地查看您实际发送的内容。也许使用 Fiddler 或一些类似的软件来记录您的请求并检查它。

// Ensure mandatory file attributes have been located. Need either destination, or site + container or updateNodeRef
      if ((filename === null || content === null) || (destination === null && (siteId === null || containerId === null) && updateNodeRef === null))
      {
         exitUpload(400, "Required parameters are missing");
         return;
      }

此外,可以在此处找到相关的 Web 脚本,它是在 JS 中实现的,因此添加额外的(临时)日志记录相对容易。

...alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\repository\upload\
于 2020-07-11T15:05:33.267 回答
0

您可以使用 api-explorer rest api 上传文档。

https://api-explorer.alfresco.com/api-explorer/#!/nodes/createNode

于 2020-07-12T05:36:19.467 回答