The CreatorCon Call for Content is officially open! Get started here.

Need to use Proxy in RestMessageV2

Dhaval Bhimani1
Kilo Expert

I have a requirement to make a rest call using mid server and take action based on response. but the product is behind the proxy. I can't use mid server script include because I have to make synchronous rest call. I can't use HttpClient because I have to make rest call via mid server. So I have a question "Is RestMessageV2 supports proxy or not?" If yes then "How to configure the proxy in RestMessageV2?"

3 REPLIES 3

Dhaval Bhimani1
Kilo Expert

p

Jace Benson
Mega Sage

Have you asked on HI?  I dont know you'll get a great answer here.

marcguegueniat
Kilo Sage

Hi,

Not sure to understand if your need is on proxy or mid server or both, so here are some links that should help

If you want your instance to directly use a proxy, you should read:

https://docs.servicenow.com/bundle/madrid-platform-administration/page/administer/import-sets/concep...

If you want your instance to use a mid server on a rest call:

Declare the mid Server and make sure it is up and running
Set the "Use Mid Server" field on each of your Http Method inside your Rest Message
Or use the setMIDServer() command if your are 100% scripting your call

If you want to use a proxy on the mid server itself, you should read:

https://docs.servicenow.com/bundle/madrid-servicenow-platform/page/product/mid-server/reference/mid-...

(look for proxy)

And finally, if your issue is with call being asynchronous (probably using a mid server) there exists a way to force it as synchronous:

var r = new sn_ws.RESTMessageV2('XXX', 'myFunc');
[set parameters]
var response = r.execute();
response.waitForResponse(60); //timeout in seconds

Hope this helps,

Regards,