The ServiceNow REST job is failing when using OAuth 2.0 with the error message below in the report log.
pool-2-thread-3: ExtensibleFrameworkClassLoader: getPackage: com.uc4.common package com.uc4.common
pool-2-thread-3: ExtensibleFrameworkClassLoader: Package already exists: com.uc4.common
pool-2-thread-3: JerseyUtils: Check response code:401
pool-2-thread-3: JerseyUtils: Response family:CLIENT_ERROR
pool-2-thread-3: JerseyUtils: Response reason:Unauthorized
pool-2-thread-3: JerseyUtils: Response type:application
pool-2-thread-3: ExtensibleFrameworkClassLoader: loadClass com.sun.jersey.core.provider.CompletableReader jar:file:/opt/automic/Agents/RA/RA.Web.Service.REST/bin/./inner_jarfiles/WebServiceRest/jersey-core.jar!/com/sun/jersey/core/provider/CompletableReader.class
pool-2-thread-3: ExtensibleFrameworkClassLoader: getPackage: com.sun.jersey.core.provider package com.sun.jersey.core.provider
pool-2-thread-3: ExtensibleFrameworkClassLoader: Package already exists: com.sun.jersey.core.provider
pool-2-thread-3: JerseyUtils: Response error text:{"error":{"message":"User Not Authenticated","detail":"Required to provide Auth information"},"status":"failure"}
Product: RA WebService REST version 4.6.16
DE174378
Workaround
The bearer token is not added to the request header of the HTTP GET/POST request. In order to move forward with this issue, please do the steps below.
1. Please do the steps a) and b)
a) Switch from the RA WebService REST to the REST Agent Integration (IG). The RA Agent is outdated and no longer maintained or supported.
b) Upgrade to v24. The v21 series is no longer maintained, and its support has ended.
2. Manually add the Bearer token to the Webservice Job's request header. To do this, add a Header named Authorization with the value Bearer XXXX, where XXXX is replaced by a valid access token. For example:
An Automic variable, for example, &AccessToken#, can be used and set in a task preceding the REST Job in the workflow. The access token can be retrieved or refreshed by a separate REST job preceding the jobs that access the resource.
Solution
The issue will be fixed in the future release of Integration REST Agent version 24.x.