In case of errors in outbound REST calls, the getErrorMessage() function does not return the error message that is originally returned by the remote server.
Steps to Reproduce
- Create an outbound REST message.
- Using the RESTMessageV2 API, send a request, ensuring that the return http status code is outside the 200-299 range.
- Use RESTResponseV2.getErrorMessage() to obtain the error response returned by the remote server.
- You will get generic response constructed by ServiceNow instead of the message that actually came from the remote service.
This problem has been fixed in Jakarta.
Versions before Jakarta just return a general error number / description. Use instead RESTResponseV2.getErrorCode() to obtain the status code returned by the remote service.
Related Problem: PRB664609