12:10, EEST
July 22, 2016
Hello Community!
Am having a weird problem and hope someone could help me.
Will demonstrate it simply – just executing the following line on a successful connection:
client.writeValue(nodeId, client.readValue(nodeId));
This reads the value from the server and directly writes it back -> no effect. However this works as intended for “Doubles” and “Strings” but when doing this with a node containing a BOOLEAN (UaExpert and the toStringWithType() function says it is a boolean), I get the following error/exception:
com.prosysopc.ua.StatusException: Bad_TypeMismatch (0x80740000) “The value supplied for the attribute is not of the same type as the attribute’s value.” StatusCode=Bad_TypeMismatch (0x80740000) “The value supplied for the attribute is not of the same type as the attribute’s value.”
How can that be? Is there a bug in the Java API? Or a configuration issue on the server?
Huge thanks in advance!
Greetings,
Alex
16:28, EEST
April 3, 2012
16:40, EEST
July 22, 2016
Thank you for your response!
Yes, it happens with a certain server. Have talked to its developer and he will look into it next week. By now I’ve found out that it is not my client because even trying to modify the value through UaExpert fails with exactly the same error: “Write to node ‘NS2|String|12’ failed [ret = BadTypeMismatch]
The Datatype according to UaExpert is “Boolean” and when reading the datatype attribute in a client it says “i=12”
Everything involving reading works correctly – in UaExpert as well as in my client. The resulting ‘variant’ contains a “true” or “false” when printed.
EDIT: Yes, the system mentions ‘String’ inside the Node Id for some reason.
Guess without the sourcecode for the server, it’s not possible to debug this, but any idea what mistake when setting up a server can cause this behavior?
17:21, EEST
April 3, 2012
“i=12” means is a NodeId with integer type and value 12 (since there is no print of namespace index, it is 0), the Identifiers class contains the standard (0) namespace NodeIds, and the 12 is String datatype. So it is an error in the server configuration. The error message is also standard, can be found in StatusCodes.Bad_TypeMismatch (it has annotation for it which is contains the text). So in this case most likely the server actually has the same type there you are trying to write (boolean), but it checks that it should be the one defined for the DataType Attribute which is String and this error should be reported then (but the message may be a bit misleading in this case).
If the NodeId Attribute shows e.g. ns 2 and “String”, then most likely this is a test/compliance node for a String datatype and it is just initialized wrong in the server.
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: 737
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1524
Posts: 6450
Newest Members:
fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerleyModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1