-->

IBM Content Collector error calling external Web S

2019-07-28 17:59发布

问题:

In my current project using IBM Content Collector 4.0.1 SP5 with IBM Filenet P8 Content Engine 5.2.1 I need to collect files from file system and add them to a certain P8's object store.

After performing upload on the server or in case of error I inserted a WS Call Web Service Task in order to submit some data to be written to a database.

The configuration is the following:

The web service is REST conformant as requested in the WS Call Web Service task description page provided by IBM, follows a code excerpt:

@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) {

When ICC tries to call the WS I get a HTTP/1.1 400 Bad Request error like this:

2017-10-20T13:47:10.394Z FINEST [47] Prepared content to send to webservice:{"e:\report\amm_000001_00001\2017\10\201710_amm_000001_00001_qxn_report_00_errato.pdf":{"esito":"KO","fileName":"Prova"},"e:\report\amm_000001_00001\2017\10\201710_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...

What am I doing wrong?

回答1:

Finally I managed to get it work eliminating the consumes parameter from the annotation; doing this will force the WS to accept every kind of possible message provided it is given through a GET or POST method.

In addition I received a hint by a IBM ICC and eDM L2 support who suggested:

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_00001\2017\10\201710_amm_000001_00001_qxn_report_00_errato.pdf":{"esito":"KO","fileName":"Prova"},"e:\report\amm_000001_00001\2017\10\201710_amm_000001_00001_qxn_report_00_errato.xml":{"esito":"KO","fileName":"Prova"}}

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