OPC-UA - Method call with "complex" input values

Ok Thanks for the quick responses!
So that worked, though I had to write
password = jarray.array(, Integer)
as
password = jarray.array(, 'i') to pass the java type.

Now, to extract the results. I see the values I want in the "Raw Outputs" of the log

But in my scripting I am getting the coerced outputs as results[2] from callMethod. Is there a way to pull the raw outputs into an array?

Adam S

No, the raw outputs are often types from the OPC UA library and need to be converted into types that can be used from Ignition / scripting. They're only printed there for debugging purposes.

The corresponding representation of an OPC UA ByteString in Ignition is a Short Array (java.lang.Short[]).

Excellent
I was able to get the array back!

resultArray = system.opcua.callMethod(connectionName, objectID, methodID, inputs)[2][0]

I know [2] here is the list of output values from the callMethod Function.
If I didn't then take [0] from that my result was returning as the whole Object with the value [[Ljava.lang.Short;@xxxxxxxx, 0].

Then I converted this data to a string with:
resultString = ''.join(chr(character) for character in resultArray) since my RFID data is ascii bytes.
In case someone else in the future needs that.

Adam S

1 Like