RESTMessageV2 API can be used directly from the instance, or via a MID Server. When used via a MID Server that is configured to connect to the instance via a Proxy, the .saveResponseBodyAsAttachment() method doesn't work.

This is because the code in the mid server calls an instance REST API directly, without going via the Proxy. 

The MID Server agent log would give an error like this:

05/19/17 10:47:44 (023) Worker-Standard:MIDWorker Worker starting: RESTProbe source: https://XXXXXX 
05/19/17 10:47:54 (211) Worker-Standard:MIDWorker WARNING *** WARNING *** connect timed out when posting to
05/19/17 10:47:54 (211) Worker-Standard:MIDWorker Enqueuing: C:\ServiceNow MID Server\agent\work\monitors\ECCSender\output_2\ecc_queue.e731ee0a4f327a04037c495d0210c7e2.xml
05/19/17 10:47:54 (211) Worker-Standard:MIDWorker Worker completed: RESTProbe source: https://XXXXXX time: 0:00:10.188

Steps to Reproduce

  1. Set up a MID Server to connect to the instance via a Proxy
  2. Create a script that uses RESTMessageV2 via a MID Server like the example in the Documentation.
  3. Before .execute(), run saveResponseBodyAsAttachment() as per the documentation of that method of the API
  4. Run that script from 'Scripts - Background.
  5. The ecc_queue output and input will be seen, but no attachment will be created in the instance.


This is Fixed from the London version and later. Please upgrade.

For earlier versions, use one of these alternatives:

  • Use a MID Server that connects to the instance without a proxy.
  • Make the REST request straight from the instance, without going via a MID Server.

Related Problem: PRB1028554

Seen In

There is no data to report.

Fixed In


Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:41:27