Here is the situation:
We have 2 gateways. Gateway #1 is hosted in the cloud, Gateway #2 is hosted inside the site network. They have allowed the Gateway-to-Gateway port through the firewall, but none other. The Gateway Network has been established and is communicating.
I want to run a script on the Internal gateway (gateway#2) and pass the results to gateway#1. Also, the function call should be initiated from gateway#1 by some mechanism (doesn’t quite matter at this point).
Is there a standard Ignition mechanism to do this?
Any idea what the configuration will look like on the side receiving the request? Is the messageHandler parameter the Global Function Name or do you have to set up a mechanism on the other side to “catch” the sendRequest?
You could send it from a client, but from your initial description it sounds like you’d want to send it from the gateway, which should also work (from further down the on the documentation page):
The part you highlighted just specifies that there are no special client permissions required to use it from a client.
@witman@jpark
So I got it to work from Gateway#1 to Gateway#2 in the designer Script Console, however in a runtime client I am getting this error message in the Thread Logs:
“…MessageHandlerException: User does not have required permissions…”
Any idea what setting needs to happen to appease the Security gods?
I can dump the full long error message if that will help you figure it out.
Actually, a runtime client shouldn’t matter. You should be sending the message only to gateway scope, and the handler should be under the gateway scripts, not the (Vision) client scripts.
Got it working. I had left the Security Zone settings as non-default on GW#2, which was blocking the action in the client session.
Here is the final configuration:
Remote Message Call from GW#1 to GW#2:
def remoteRequestGetTagsValueForDate(tagsList, dt):
try:
requestReturn = system.util.sendRequest(project=‘Sandbox’, messageHandler=‘getTagsValueForDate’, payload={‘tagsList’:tagsList, ‘dt’:dt}, remoteServer=“ignition-ip-172-00-00-01”, timeoutSec=10000)
return requestReturn
except:
return “Error running global function”
Message Handler config on GW#2:
Global Script defined on GW#2:
def getTagsValueForDate(tagsList, dt):