OPCUA server have a method with one input argument e.g.
protected Variant[] invoke(InvocationContext invocationContext, Variant[] inputValues) {
logger.debug("Invoking sqrt() method of objectId={}", invocationContext.getObjectId());
double x = (double) inputValues[0].getValue();
double xSqrt = Math.sqrt(x);
return new Variant[]{new Variant(xSqrt)};
}
At the OPCUA client, can I call this method with array int? e.g.[1,4,9,16,25]
CallMethodRequest request = new CallMethodRequest(
objectId,
methodId,
new Variant[]{new Variant(input)}
);
At here, the inputArguments is Variant array, can I set with [1,4,9,16,25] and get [1,2,3,4,5]?
No, it doesn't work that way.
You can send 5 CallMethodRequest
s inside one CallRequest
, though.