Calling server-method with an argument with valueRank > 1 fails with BadInvalidArgument
Current behavior
Registering a server-method that has an input-argument with a valueRank > 1 works, but calling the method fails. The client reports BadInvalidArgument. No errors or warning are reported on the server side.
Describe the bug
Browsing the method from a client like UaExpert works. The arguments reported by the server to client appear to be correct. Setting the argument values from the client works, but calling the method fails with a BadInvalidArgument.
I'm unsure if:
- Is the client actually calling the method on the server-side, or does it fail on the client before anything is transmitted to the server?
- Is it a bug from within node-opcua, a bug on the client-side or am I doing something wrong when registering the method?
Step by step instruction to reproduce I've adjusted the server with method sample to register a method with a 2x2 Int32 array as input-argument. Running the following (almost) minimal sample starts the server:
const {
OPCUAServer,
DataType,
Variant,VariantArrayType,
StatusCodes,
makeAccessLevelFlag
} = require("node-opcua");
(async () => {
try {
const server = new OPCUAServer({
port: 4334 // the port of the listening socket of the server
});
await server.initialize();
const addressSpace = server.engine.addressSpace;
const namespace = addressSpace.getOwnNamespace();
const myDevice = namespace.addObject({
organizedBy: addressSpace.rootFolder.objects,
browseName: "MyDevice"
});
//_"adding a method on the device object"
const method = namespace.addMethod(myDevice,{
browseName: "Bark",
inputArguments: [
{
name:"nbBarks",
description: { text: "specifies the number of time I should bark" },
dataType: DataType.Int32,
valueRank: 2,
arrayDimensions: [2, 2]
}
],
outputArguments: [{
name:"Barks",
description:{ text: "the generated barks" },
dataType: DataType.UInt32,
valueRank: -1
}]
});
//_"binding the method with your own function"
method.bindMethod((inputArguments,context,callback) => {
const callMethodResult = {
statusCode: StatusCodes.Good,
outputArguments: [{
dataType: DataType.String,
arrayType: VariantArrayType.Array,
value :99
}]
};
callback(null,callMethodResult);
});
await server.start();
console.log("Server is now listening ... ( press CTRL+C to stop)");
const endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl;
console.log(" the primary server endpoint url is ", endpointUrl );
}
catch(err) {
console.log(err);
}
})();
Browse the server using any opcua-client supporting method-calls, for example UaExpert. The attributes of the input-arguments seem to look fine:

When calling the method, entering the array-values work:

But the call fails with BadInvalidArgument:

No errors or warnings are reported on the server-side.
Expected behavior That the registered method on the server gets called.
Gist https://gist.github.com/eg-be/7977f5f5de8af11cfebfe672dae33934
Context
-
( X ) my request is related to node-opcua acting as an OPCUA SERVER
-
( X ) I have installed node-opcua as a package ( using npm install )
-
Device: PC
-
OS version: Windows 10
-
node-opcua version: :
D:\Dev\OpcuaMethod>npm view node-opcua version
2.69.1
- Node:
node --version = v16.15.0
fixed in [email protected]