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

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:

Index OrderDescription
0Resulting StatusCode for the call
1A list of StatusCode objects corresponding to each input argument
2A 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 OrderDescription
0The value of the code
1The name of the code
2A description of the code
Code Examples
Code Snippet
# 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]
Keywords

system opcua callMethod, opcua.callMethod