14:47, EEST
August 20, 2014
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
16:43, EEST
August 20, 2014
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?
10:09, EEST
April 3, 2012
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.
10:21, EEST
April 3, 2012
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.
Most Users Ever Online: 1919
Currently Online:
20 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 727
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1