Troubleshooting outbound REST web services


Description


Outbound REST functionality enables you to retrieve, create, update, or delete data on a web services server that supports the REST architecture. You can send a REST message by a REST workflow activity or by using the RESTMessageV2 script API.




Release or Environment

All

Cause

In the newer versions of ServiceNow you can follow the below steps :

1) For outbound rest messages: System Web Services -> Outbound

Select the SOAP or the REST message . Select the method

Under Related Links -> Set HTTP Log level -> All


If logging needs to be enabled through script , add the statement

rm.setLogLevel('all');


2) For Flow Designer/Spoke Rest or Soap steps to check outbound web service logs

 Set the system properties . Please note these are global properties and affect all the outbound web services logging . Please disable once the logs are captured

Filter navigator -> sys_properties.list

glide.outbound_http_log.override.level  = all

glide.outbound_http.content.max_limit = 1000

glide.outbound_http_log.override = true


3) To check the Outbound HTTP logs

 Filter Navigator -> Outbound HTTP Requests

Locate the outbound call that was made

Open the log record . Check the "Request" and "Response" tabs


In older versions of ServiceNow

To troubleshoot outbound REST issues, set the system property glide.rest.outbound.debug to true.

  1. Go to /sys_properties_list.do.

  2. If the glide.rest.outbound.debug system property is not listed in the table, click New and create the property with the following following values:


    • Name: glide.rest.outbound.debug
    • Type: true|false
    • Value: true

    Once this property is set, additional information about the outbound REST message is captured in the logs.

  3. Navigate to System Logs > Node Log File Browser.

    Note that you will be able to read the node log file only for the node you are currently logged in to. If you are unable to find the output for your REST call, the REST call might have been processed by another node. Try to log in through a different browser or private browsing window (incognito window) and see whether you can find the information on those node log files, or contact support for assistance with retrieving the information from the log files.

  4. Select the time frame during which the outbound REST call is made and Message contains REST Msg Outbound.

In the following example, an outbound REST call is made from one instance to another. This will give you additional information about the headers and the body that is sent out.

If any errors are encountered you can check them in the logs.

Note: Test the outbound REST message first outside ServiceNow by using tools such as cURL, POSTMAN, or any other REST client.


2017-12-28 15:12:31 (663) Default-thread-201 42EE184A4FDB0B002BEDA9D18110C707 DEBUG: REST Msg Outbound - RESTMessageClient : Executing: Outbound REST Message/Method: OutboundIncidentREST/post
HTTP Request:
POST https://<instance-name>.service-now.com/api/now/table/incident
Content-Type: application/json
Authentication type: basic
Authentication profile: 
Profile name: <profile-name>
Username: admin
Password: ********
Mutual Auth: false
ECC Queue: false
Request Content:
Length: 66
Content: {"caller_id":"Abel Tuter","short_description":"from REST POST123"}
2017-12-28 15:12:32 (325) Default-thread-201 42EE184A4FDB0B002BEDA9D18110C707 DEBUG: REST Msg Outbound - RESTMessageClient : Response: Outbound REST Response
HTTP Status: 201 Created