node-opcua / node-opcua

Unlocking the Full Potential of OPC UA with Typescript and NodeJS - http://node-opcua.github.io/
MIT License
1.48k stars 481 forks source link

Method with more than one custom variable types fails on UA Expert GUI #1308

Closed jrk94 closed 7 months ago

jrk94 commented 1 year ago

Current behavior

I created two custom datatypes, Temp and Humid. I created an opc-ua server with a method that uses these two custom datatypes as inputs. When I try to call the method, UA Expert always assumes the first input when trying to write.

image image

If I select Temperature it gives me as value the correct TemperatureDataType, but if I select humid, it also gives me HumidDataType

PS: this may be a bug on UA Expert side, but at least for me it is de de facto tool to valide everything is correct so I am afraid there's something missing on either the custom datatype creation or on the method registration, nevertheless I also opened a ticket in ua expert (https://forum.unified-automation.com/viewtopic.php?f=22&t=8137&p=13334#p13334)

Describe the bug Error: "Failed with error 'BadInvalidArgument'"

Step by step instruction to reproduce

Steps to reproduce the behavior:

  1. Create two or more custom variable types
  2. Create an opc ua server with a method that has more than two custom variable types as inputs
  3. Try calling it through UA Expert

Expected behavior

Be able to call the method through UA Expert

Context

jrk94 commented 1 year ago

I believe that in "node-opcua": "2.28.3", this was working

erossignon commented 1 year ago

@jrk94 It would be cool if you could provide a full gist (nodeset2.xml + server.ts + package.json to facilitate investigation.

jrk94 commented 1 year ago

@erossignon I have done some more investigation and the problem was introduced in V2.60.0. Next step I will try to see if I can pinpoint to a particular PR.

I am showing in the gif two servers one with 2.60.0 and another with 2.57.0 and the code I am using for replicating this.

CustomDataTypesIssue ServerDemo.zip

erossignon commented 11 months ago

Creating extension objects requires additional work such as creating the Default Encoding nodes etc..., producing the BSD definition etc...

I would recommend that you use a modeling tool to create a dedicated nodeset2 containing the full definition of your extensions object.

This is easily achieved with the OPCUA Modeler developed by the author of node-opcua :

https://opcua-modeler.doc.sterfive.com/fr/docs/nodeset-yaml-format/s41_data-types-extension-objects