How to change to JSON stringify : Cannot decode: java.io.StringReader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2019 06:47 AM
I have this Business Rule for Rest Message Patch method that I need to fix because I keep having this error.
HTTP Status : {"error":{"detail":"Cannot decode: java.io.StringReader@70dd85","message":"Exception while reading request"},"status":"failure"}
(function executeRule(current, previous /*null when async*/) {
// Condition is : current.correlation_idISNOTEMPTY
gs.log('In Business Rule New Run', 'check');
try {
var comment = current.comments.getJournalEntry(1);
gs.log('Comment : ' + comment, 'check');
gs.log('Cor ID : ' + current.correlation_id, 'check');
var r = new sn_ws.RESTMessageV2('Ebond', 'Patch Ebond');
r.setStringParameterNoEscape('sys_id', current.correlation_id);
r.setStringParameterNoEscape('comments',comment);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log('HTTP Status : ' + responseBody,'check');
}
catch(ex) {
var message = ex.message;
}
gs.log("End Business Rule", 'check');
})(current, previous);
Labels:
- Labels:
-
Scripting and Coding
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2020 10:54 AM
You are getting this error because of the input you are giving as a payload. And the restend point was not able to encode the format you are sending with.