简体   繁体   English

将布尔值写入OPC UA服务器-“类型不同”错误

[英]Write Boolean to OPC UA server - “not of the same type” error

Will demonstrate it simply. 将简单地演示它。 I'm just executing the following line: 我只是执行以下行:

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 says it is a boolean), I get the following error/exception: 但这按预期用于“双精度”和“字符串”,但是当对包含BOOLEAN的节点执行此操作时(UaExpert表示它是布尔值),我得到以下错误/异常:

com.prosysopc.ua.StatusException: Bad_TypeMismatch (0x80740000) "The value supplied for the attribute is not of the same type as the attribute's value." com.prosysopc.ua.StatusException:Bad_TypeMismatch(0x80740000)“为属性提供的值与属性的值类型不同。” StatusCode=Bad_TypeMismatch (0x80740000) "The value supplied for the attribute is not of the same type as the attribute's value." “ StatusCode = Bad_TypeMismatch(0x80740000)”为属性提供的值与属性的值类型不同。


How can that be? 怎么可能? Is there a bug in the Java API? Java API中是否有错误? Or a setting issue in the server? 还是服务器中的设置问题?

Huge thanks in advance! 提前非常感谢!

The error message is pretty obvious. 错误消息非常明显。 I used to always have these errors they always occur if there's a type mismatch. 我曾经经常遇到这些错误,如果类型不匹配,它们总是会发生。 Look in the server if the variable is boolean which is being assigned the value and check the type in your program 在服务器中查看变量是否为布尔值(正在为其分配值),并检查程序中的类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM