Rest Message returns null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 06:46 AM
I am calling a third party API with the help of Rest message.
I have written the rest message script in a script include.
That script include function will be called periodically using scheduled script execution.
Mostly I am getting the response correctly but sometimes it fails.
Sometimes, calling the rest messagev2 script returns null as response body with 200 response status
Can anyone explain me the solution for this problem ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 08:16 AM
No I am trying to access a third party server installed in LAN using midserver.And the communication without midserver is not possible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 08:19 AM
If the communication is through the midserver, the call & response will be in the ECC Queue. Look in there to see how both were built.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 08:24 AM
Hi Eswari,
It could be timing out. Can you try increasing the timeout using the waitforresponse api to see if it works?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2018 06:47 AM
Hey eswari,
I found this article when i had the same issues. I think this happens if you are using a mid-server to pass your REST requests to access the data which is lying in a local server applications.
can you try adding this script :
var k = 1;
while ( response == null ) {
gs.info( " waiting ... " + k + " seconds");
response = r.getResponse(1000);
k++;
if ( k > 30 ) {
gs.info(' service time-out');
break;
}
}
https://community.servicenow.com/community?id=community_question&sys_id=22f647e5db1cdbc01dcaf3231f9619c0