erikbos
Giga Contributor

Hi Silas,



Thanks for your response. With the debug settings I get a few logging entries:



[0:00:05.373] Script completed in scope global: script



REST Msg Outbound - RESTMessageClient : Executing synchronous request


REST Msg Outbound - RESTMessageClient : Executing: Outbound REST Message/Method: null/get


HTTP Request:


  GET https://X/api/1.0/buildings/all/


Basic Auth: true


  Username: ********


  Password: ********


Mutual Auth: false


ECC Queue: true


  MID Server: nlsrvud-snp01


  ECC Correlator: null


  ECC Params: NONE




REST Msg Outbound - ECCRESTRequestDispatcher : Inserting into ECC Queue with details: RESTProbe get https://X/api/1.0/buildings/all/ null,mid.server.nlsrvud-snp01


REST Msg Outbound - ECCRESTRequestDispatcher : Inserting into ECC Queue with payload: <?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="message_headers" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;fields/&gt;"/><parameter name="message_parameters" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;fields/&gt;"/><parameter name="source" value="https://X//api/1.0/buildings/all/"/><parameter name="name" value="get"/><parameter name="rest_user" value="********"/><parameter name="rest_password" value="enc:X=="/></parameters>


REST Msg Outbound - RESTMessageClient : Response: com.glide.rest.outbound.ecc.ECCRESTResponse@f82f0dECC Output:


  Output Queue SysId: c611e0700f828e00661b7f5ce1050e76


  Timeout (seconds): 300




Time: 0:00:00.136 id: tomtomdev_1[glide.18] for: (SELECT ecc_queue00010.`sys_id`, 'ecc_queue0001' AS `sys_table_name` FROM ecc_queue0001 ecc_queue00010   WHERE ecc_queue00010.`response_to` = 'c611e0700f828e00661b7f5ce1050e76') UNION ALL (SELECT ecc_queue00020.`sys_id`, 'ecc_queue0002' AS `sys_table_name` FROM ecc_queue0002 ecc_queue00020   WHERE ecc_queue00020.`response_to` = 'c611e0700f828e00661b7f5ce1050e76') UNION ALL (SELECT ecc_queue00030.`sys_id`, 'ecc_queue0003' AS `sys_table_name` FROM ecc_queue0003 ecc_queue00030   WHERE ecc_queue00030.`response_to` = 'c611e0700f828e00661b7f5ce1050e76') UNION ALL (SELECT ecc_queue00040.`sys_id`, 'ecc_queue0004' AS `sys_table_name` FROM ecc_queue0004 ecc_queue00040   WHERE ecc_queue00040.`response_to` = 'c611e0700f828e00661b7f5ce1050e76') UNION ALL (SELECT ecc_queue00050.`sys_id`, 'ecc_queue0005' AS `sys_table_name` FROM ecc_queue0005 ecc_queue00050   WHERE ecc_queue00050.`response_to` = 'c611e0700f828e00661b7f5ce1050e76') UNION ALL (SELECT ecc_queue00060.`sys_id`, 'ecc_queue0006' AS `sys_table_name` FROM ecc_queue0006 ecc_queue00060   WHERE ecc_queue00060.`response_to` = 'c611e0700f828e00661b7f5ce1050e76')


*** Script: 404


silas1
ServiceNow Employee

Erik, one thing I notice in the log is that the rest message appears to be null:


REST Msg Outbound - RESTMessageClient : Executing: Outbound REST Message/Method: null/get


Are you sure you're accessing the Rest message correctly by name? One thing to keep in mind, if this is part of a scoped application you might need to reference the rest message by it's scoped name e.g. "x_acme_myapp.Device42".


View solution in original post

silas1
ServiceNow Employee

Also, you did get a response back from the server, it's a 404. The reason it "hangs" is because it has to wait to be picked up by the MID server which I believe will poll for work every 15 seconds. Note that if you don't care about the response i.e. if it's a fire and forget kind of request, you can send the request with .execute() and then don't call any method on the response like getBody or getStatus -- those will cause the client to block waiting for the response.


erikbos
Giga Contributor

Hi Silas, the problem was actually much more simple than I thought: I tried a few options (creating the RESTMesssageV2 object myself, or using the one you configure via the UI).




The console debug information led me down the wrong path and somehow the first REST requests appeared to be "stuck" in the ECC queue. While looking at the input/output timestamps it shows they got half an hour after the REST-request was requested. (A mid server restart fixed that.)




In the end I did end up with a working script without noticing 😉 Oops, thanks for your help!


silas1
ServiceNow Employee

Glad you were able to figure it out Erik! If the REST message debugging was not as helpful to you in figuring out this issue, I'm curious if anything about the debug info could have been changed to make it more helpful? Or is something missing altogether?