向 OPC UA 服务器写入布尔值 - “不同类型"错误 [英] Write Boolean to OPC UA server - "not of the same type" error

查看:193
本文介绍了向 OPC UA 服务器写入布尔值 - “不同类型"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单演示一下.我只是在执行以下行:

Will demonstrate it simply. I'm just executing the following line:

client.writeValue(nodeId, client.readValue(nodeId));

这会从服务器读取值并直接将其写回 - 无效.然而,这对双倍"和字符串"有效,但是当使用包含 BOOLEAN 的节点(UaExpert 说它是一个布尔值)执行此操作时,我收到以下错误/异常:

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:

com.prosysopc.ua.StatusException: Bad_TypeMismatch (0x80740000)为属性提供的值与属性的值." StatusCode=Bad_TypeMismatch (0x80740000) 为属性提供的值与属性的值."

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

<小时>

怎么会这样?Java API 中是否存在错误?还是服务器设置问题?


How can that be? Is there a bug in the Java API? Or a setting issue in the server?

提前致谢!

推荐答案

错误信息非常明显.我以前总是有这些错误,如果类型不匹配,它们总是会发生.在服务器中查看变量是否为布尔值,并检查程序中的类型

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

这篇关于向 OPC UA 服务器写入布尔值 - “不同类型"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆