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
Write Boolean to OPC UA server - “not of the same type” error
July 22, 2016
12:10, EEST
Avatar
Alex
Member
Members
Forum Posts: 4
Member Since:
July 22, 2016
sp_UserOfflineSmall Offline

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

July 22, 2016
16:28, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Does this happen when connecting to a specific server? What is the DataType Attribute of the node? What is the value shown e.g. in UaExpert? What is the value received by the client?

– Bjarne

July 22, 2016
16:40, EEST
Avatar
Alex
Member
Members
Forum Posts: 4
Member Since:
July 22, 2016
sp_UserOfflineSmall Offline

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?

July 22, 2016
17:21, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

“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.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
33 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: 730

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1