调用外部 Web 服务的 IBM Content Collector 错误

IBM Content Collector error calling external Web Service

在我当前使用 IBM Content Collector 4.0.1 SP5 和 IBM Filenet P8 Content Engine 5.2.1 的项目中,我需要从文件系统收集文件并将它们添加到某个 P8 的对象存储中。

在服务器上执行上传后或出现错误时,我插入了 WS Call Web Service Task 以提交一些要写入数据库的数据。

配置如下:

根据 IBM 提供的 WS Call Web Service task description page 中的要求,Web 服务符合 REST 标准,代码摘录如下:

@RequestMapping(value = "/filenet/notificaArchiviazione", method = { RequestMethod.GET,
                      RequestMethod.POST }, consumes = { MediaType.APPLICATION_FORM_URLENCODED_VALUE,
                                     MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE }, produces = {
                                                    MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
       @ResponseBody
       String notificaArchiviazione(@RequestParam("fileName") String fileName, @RequestParam("esito") String esito) {

当 ICC 尝试调用 WS 时,我收到 HTTP/1.1 400 Bad Request 错误,如下所示:

2017-10-20T13:47:10.394Z FINEST [47] Prepared content to send to webservice:{"e:\report\amm_000001_00001171710_amm_000001_00001_qxn_report_00_errato.pdf":{"esito":"KO","fileName":"Prova"},"e:\report\amm_000001_00001171710_amm_000001_00001_qxn_report_00_errato.xml":{"esito":"KO","fileName":"Prova"}}
[com.ibm.afu.connector.webservice.task.InvokeServiceTask getInputHttpEntity] [CTMS-task-12dc 44] 2017-10-20T13:47:10.456Z FINEST [48] Configuration: http://192.168.8.29:8080/sirfAcq/filenet/notificaArchiviazione fileName
esito
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute] [CTMS-task-12dc 44] 2017-10-20T13:47:10.830Z FINEST [49] Invoking webservice URI:http://192.168.8.29:8080/sirfAcq/filenet/notificaArchiviazione
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute] [CTMS-task-12dc 44] 2017-10-20T13:47:13.763Z FINEST [50] Invocation took time (ms): 2933
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute] [CTMS-task-12dc 44] 2017-10-20T13:47:13.763Z SEVERE [51] Failed to invoke webservice: HTTP/1.1 400 Bad Request
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute] [CTMS-task-12dc 44] 2017-10-20T13:47:13.841Z FINEST [52] [ctms-native] 2017-10-20T13:47:13Z Trace2 0x12dc Invocation successfull, task finished...

我做错了什么?

最后我设法让它工作,从注释中删除了 consumes 参数;这样做将强制 WS 接受每一种可能的消息,前提是它是通过 GET 或 POST 方法给出的。

此外,我还收到了一位 hint by a IBM ICC and eDM L2 support 的建议:

It appears that your web server does not understand the request that is being sent from ICC.

This is the request being sent from ICC (from the log snippet you provided):

{"e:\report\amm_000001_00001171710_amm_000001_00001_qxn_report_00_errato.pdf":{"esito":"KO","fileName":"Prova"},"e:\report\amm_000001_00001171710_amm_000001_00001_qxn_report_00_errato.xml":{"esito":"KO","fileName":"Prova"}}

Check your code if it is able to parse the data above.