system.opcua.callMethod
This function is used in Python Scripting.
Description​
Calls a method in an OPC UA server. To make the most of this function, you'll need to be familiar with methods in the OPC UA server.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.opcua.callMethod(connectionName, objectId, methodId, inputs)
Parameters​
Type | Parameter | Description |
---|---|---|
String | connectionName | The name of the OPC UA connection to the server that the method resides in. |
String | objectId | The NodeId of the Object Node the Method is a member of. |
String | methodId | The NodeId of the Method Node to call. |
List | inputs | A list of input values expected by the method. |
Returns​
Tuple - A tuple containing the following:
- 0 Resulting StatusCode for the call
- 1 A list of StatusCode objects corresponding to each input argument
- 2 A list of output values.
Scope​
Gateway, Perspective Session
The StatusCode Object​
This function returns multiple StatusCode objects. StatusCode is a tuple, containing the following:
Index Order | Description |
---|---|
0 | The value of the code |
1 | The name of the code |
2 | A description of the code |
Code Examples​
Example #1
# Call the Server object's GetMonitoredItems method.
result = system.opcua.callMethod(
"Ignition OPC UA Server",
"ns=0;i=2253",
"ns=0;i=11492",
[1]
)
# Below we print the various elements in the results. The print statements could easily be replaced by something more useful.
# Prints the StatusCode for the call.
print result[0]
# Prints the list of StatusCodes, one for each input argument passed to system.opcua.callMethod.
print result[1]
# Prints the output values from the call.
print result[2]