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
version 4.0.2 IdentifierDescriptions.toNodeId() not working anymore
June 20, 2019
10:33, EEST
Avatar
Christv
Member
Members
Forum Posts: 9
Member Since:
August 9, 2016
sp_UserOfflineSmall Offline

NodeId nodeid = IdentifierDescriptions.toNodeId(“Float”)
throw java.lang.IllegalArgumentException: NodeId not found: Float

this is same for all datatypes!
using prosys-opc-ua-sdk-for-java-4.0.2-808-client-server-binary

June 20, 2019
12:17, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi, thanks for the notification.

Seems this did break in 4.0.0 as the stack layer was integrated as part of the SDK (https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_4_Release_Notes.html#version-4-0-0).

Do you have a use-case in which that method would be useful or cases which cannot be workarounded?

Note that it could ever only give NodeIds of the standard namespace, so I’m not that sure about it’s usefullness. Internally it only would be used from deprecated methods used to load the (really) old ModelDesign.xsd based files, which SDK doesn’t anymore support (as all information models use the NodeSet2 format). Therefore I’m not exactly sure should the method be even kept. However I do see some potential use-cases, but I would personally store the NodeIds (or well it would be always even better to store the namespace as uri and not the index) instead of the “name” as String. Additionally I have seen at least one server that used the same BrowseName for a DataType and a VariableType.

We’ll try to fix this to the next version. Note however that 4.0.2 did some changes on how the Identifiers are generated (https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_4_Release_Notes.html#version-4-0-2). Basically we are hitting java limits on how big the classfile can be so that it still compiles. Those changes will allow us to split the interfaces into sub-interfaces to contain more standard identifiers (as the standard model keeps on growing…). Exactly for 4.0.2 if you just want to get the standard data type NodeIds, the following workaround should work (does not include exception handling etc., also this might break in the future):

Class<?> clazz = Class.forName("com.prosysopc.ua.stack.core.DataTypeIdentifiers");
for (Field f : clazz.getFields()) {
if (!f.getType().equals(NodeId.class)) {
continue;
}
f.setAccessible(true);
NodeId nodeId = (NodeId) f.get(null);
String name = f.getName();
// Store to a map and look up from there
}
June 20, 2019
12:51, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hmm actually,

Class<?> clazz = Class.forName("com.prosysopc.ua.stack.core.Identifiers");

there would seem to still work even with the split, so the fix is a lot easier than I thought first. Still I would prefer a solution that utilizes the codegen and not reflection on field names as reflection can break if obfuscation is used.

June 26, 2019
14:06, EEST
Avatar
Christv
Member
Members
Forum Posts: 9
Member Since:
August 9, 2016
sp_UserOfflineSmall Offline

we use a configuration database where all tags we want to read from OPC (UA/DA) with in string form we want to see the data returned.
Internally for OPC UA this string must be translate to a nodeId so easy way was NodeId nodeid = IdentifierDescriptions.toNodeId(“Float”)
now I added a translate method to solve the problem, but of course I will need to update it if new datatype are introduced in future.
so it would be nice to have a default string to nodeid converter build in

June 26, 2019
14:47, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

I see. I have fixed this now in the latest beta build we have, send mail to uajava-support@prosysopc.com if you want to try, otherwise it will be part of the next release (no exact dates on that, as it is summer vacation season here in Finland). It still uses reflection though.

Just note that DataTypes in UA are not limited to the standard model, any model could add their own ones, in which case that storage logic might not be enough or work. I wont go here in great details as otherwise this would be very long post.

There are Built-in (e.g. String), Simple (e.g. DurationString) and Structured (anything below ‘Structure’ type) DataTypes. Simple types are subtypes of Built-in types. Structures are collections of fields that can have any type. Encoded binary format of Simple types is the same as their super Built-in type. Structures have their own rules. Basically as long as you’ll need to only write values to nodes having their DataType as a Built-in type or a Simple type you should be fine (encoding-wise at least, if a subtype defines additional rules e.g. valid values are only a part of the Built-in type you might get errors from the server).

I hope that didn’t confuse too much..

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
10 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: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1468

Posts: 6262

Newest Members:

joliecheney96, digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek

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: 322, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1