Web Services After Operation Rule to Print Response Body

Hi all,
I’m trying to write an after operation rule on a web services source that only prints the response body from the http request. All I want is to see the data that is returned from the request in pure json form. I thought this would be as simple as log.info(“rawResponseObject” + rawResponseObject) or log.info(“processedResponseObject” + processedResponseObject), but both are printing ‘void’. I know there is data because the endpoint operation is completing successfully. The purpose of this rule is just for troubleshooting future issues. Can anyone help show me the correct way to do this?
Thank you.

Hi @nick_lubrano ,
Greetings of the day !

please use the below line to print.

log.info(“processedResponseObject” + processedResponseObject.toString())

Let me know for queries.
Thank You
Mahesh M

1 Like

log.error(rawResponseObject);

Would show the raw response of the call, so json in your case

log.error(processedResponseObject);

Would show the mapped response, as per the response mapping setting on the source.

If you’re getting a void on the first, that means that the connector does not receive a response, could be that the data is cleared somehow or otherwise missing? Have you tried to do the same with some local client (postman, bruno)?

Both I’ve used in exactly the same scenario (understanding the data that I retrieved from the web application, so I know it should work.

Btw. if you use log.error for your (initial) troubleshooting, it will always spawn to the ccg.log file, which makes it easier for you to read. Later switch to log.debug so you can turn on debugging to make it show up.

Thank you both for your responses. The issue was resolved with the simple addition of .toString().