Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
OPC UA Client Browsing: The given NodeId is not for a type
August 2, 2021
14:47, EEST
Avatar
Ibrahim
Member
Members
Forum Posts: 76
Member Since:
August 20, 2014
sp_UserOfflineSmall Offline

Hi,
this is happening in OPC UA Java SDK Version 4.4.2-1266 while browsing a server address space. We have successfully browsed several UA Servers with this client like Kepware, Beckhoff, Siemens S7-1500, Unified Automation UaCpp Demo Server and many others.. but this time we are trying to browse a custom developed Ua Server. During this browsing we are getting the following exception:

Exception while browsing OPC UA Server: The given NodeId is not for a type (getNode does not return UaType)<
com.prosysopc.ua.client.AddressSpace.getType(SourceFile:1082)
com.itac.oem.apiflowstudio.opcua.service.opcua.client.UaBrowser.browseNode(UaBrowser.java:135)
com.itac.oem.apiflowstudio.opcua.service.opcua.client.UaBrowser.browseNode(UaBrowser.java:159)
com.itac.oem.apiflowstudio.opcua.service.opcua.client.UaBrowser.createXMLOutputFromBrowsingServer(UaBrowser.java:101)
com.itac.oem.apiflowstudio.opcua.service.opcua.client.UaBrowser.run(UaBrowser.java:83)
com.itac.oem.apiflowstudio.opcua.service.opcua.services.OpcUaServerXmlGenerator.call(OpcUaServerXmlGenerator.java:67)
com.itac.oem.apiflowstudio.opcua.service.opcua.services.OpcUaServerXmlGenerator.call(OpcUaServerXmlGenerator.java:44)
javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.lang.Thread.run(Thread.java:748)

Line 135 in Class UaBrowser is the following:
UaType uaType = addressSpace.getType(dataTypeNodeId);

Hope you can help us with this issue. Please let me know if you need more details.

Thanks

Ibrahim

August 2, 2021
16:43, EEST
Avatar
Ibrahim
Member
Members
Forum Posts: 76
Member Since:
August 20, 2014
sp_UserOfflineSmall Offline

We found out root cause of this behaviour. If we look at the attributes of one of the nodes where this happenes with UaExpert, we see that the DataType field is empty. And the NodeId of the Data type shows:

NS-Index: 0
IdentifierType: Numeric
Identifier: 0

This causes our application to run into this exception. But what i dont understand is that UaExpert is somehow able to identify the correct dataType of that node in the DataAccess view. How is that possible? Is there a way to get the dataType of node different then from the attributes of the node?

August 3, 2021
10:09, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

I could most likely spend at least a day talking about this alone since it gives some troubles, but this is the short version; ask if unclear.

Variant’s binary encoding uses a so called builtin-type id: https://reference.opcfoundation.org/Core/docs/Part6/5.1.2/, OPC UA Binary-wise only these types really exist, everything else is constructed with them in some way.

The DataTypeId is not in the binary stream, only the builtin-type id (this is most likely one of the OPC UA’s optimizations). It is possible to just use this information alone, and as far as I know, UaExpert is basically “just using this”. It might do then something more on top of that via the DataTypeId, but basically that is how it is able to show it (technically this is not the “correct datatype”, but it might be equal to it if the DataTypeId would be a built-in datatype). That is also why it cannot Write to a node if the Value is null (nothing to deduce the type from).

The same thing sort of can be done in our SDK via DataValue.getValue().getValue().getClass() (with a null check added in a real case). However, for a 100% correct handling it should be combined with the DataTypeId (but for some use-case the Class might be enough). For example, Enumerations are binaryencoded as Int32 (https://reference.opcfoundation.org/Core/docs/Part6/5.2.4/). Only via the DataTypeId you can know which enum it was. Also for types that are subtypes of builtin types, the encoding for is always the super-build-in-type. While a Read might not need the info, a Write should know it, since e.g. a DurationString (in UA a subtype of String) DataTypeId’d node would only accept a subset of String (but in encoding it is a String; and also in our SDK it is a java.lang.String always since it is final). For Structures, they are encoded as ExtensionObjects, those have a NodeId, but is an “Encoding Id”, not the DataTypeId.

P.S.
Anyway, the DataTypeId must be in the server properly, thus it is a bug there and should be fixed.

August 3, 2021
10:21, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

And I guess I should note this as well:
There must always be a fixed known set of encoding rules, since the opc.tcp as in tcp is full-duplex stream of bytes. This means that for decoder it must know how many bytes things take so it can separate things from the stream of bytes. If that would be instead unknown, the stream would break (partially or fully) and thus the connection would break.

That is why Structures are inside an ExtensionObject, since it has a fixed form (i.e. includes a length field) decoders know how many bytes to take for it. Then if the “Encoding Id” is known (or can be resolved from the server) it can be decoded to that Structure. Otherwise it can be kept as an ExtensionObject.

August 4, 2021
9:55, EEST
Avatar
Ibrahim
Member
Members
Forum Posts: 76
Member Since:
August 20, 2014
sp_UserOfflineSmall Offline

Hi Bjarne,
thank you very much. This was very helpful.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 683

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1