微凉的衣柜 2021-12-24 21:04 采纳率: 62.9%
浏览 422
已结题

OPCUA open62541连接西门子840d sl出现错误,有偿求解。

采用open62541连接连接西门子840d sl服务器,连接代码如下:

...
UA_Client *client = UA_Client_new();
UA_ClientConfig *cc = UA_Client_getConfig(client);
UA_ClientConfig_setDefault(cc);
cc->securityMode = UA_MESSAGESECURITYMODE_SIGN;
UA_StatusCode retval = UA_Client_connectUsername(client, "opc.tcp://192.168.1.1:4840", "Account", "Passw");
...

出现错误如下:

[2021-12-24 11:52:45.093 (UTC+0800)] warn/userland      AcceptAll Certificate Verification. Any remote certificate will be accepted.
[2021-12-24 11:52:45.134 (UTC+0800)] info/channel       Connection 192 | SecureChannel 2027298388 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None and a revised lifetime of 600.00s
[2021-12-24 11:52:45.135 (UTC+0800)] info/client        Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2021-12-24 11:52:45.139 (UTC+0800)] info/client        Rejecting endpoint 0: security mode doesn't match
[2021-12-24 11:52:45.139 (UTC+0800)] info/client        Rejecting endpoint 1: security mode doesn't match
[2021-12-24 11:52:45.140 (UTC+0800)] info/client        Rejecting endpoint 2: security policy not available
[2021-12-24 11:52:45.140 (UTC+0800)] info/client        Rejecting endpoint 3: security mode doesn't match
[2021-12-24 11:52:45.140 (UTC+0800)] info/client        Rejecting endpoint 4: security policy not available
[2021-12-24 11:52:45.140 (UTC+0800)] info/client        Rejecting endpoint 5: security mode doesn't match
[2021-12-24 11:52:45.140 (UTC+0800)] info/client        Rejecting endpoint 6: security policy not available
[2021-12-24 11:52:45.141 (UTC+0800)] error/client       No suitable endpoint found
[2021-12-24 11:52:45.149 (UTC+0800)] info/client        Client Status: ChannelState: Closed, SessionState: Closed, ConnectStatus: BadInternalError

采用UaExpert可以连上服务器并读取变量,服务器属性如下:

img

猜测应该是security policy设置有问题,但不知道如何设置。项目比较简单但比较紧急,只需编写Qt OPCUA客户端实现对西门子840d服务器变量访问,可有偿解决,价格可进一步商量:line_cliche@foxmail.com。感谢!

  • 写回答

8条回答 默认 最新

  • soar3033 2021-12-28 22:43
    关注

    MiniWeb 用户和读取权限你弄了?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

问题事件

  • 系统已结题 1月8日
  • 已采纳回答 12月31日
  • 赞助了问题酬金 12月24日
  • 创建了问题 12月24日

悬赏问题

  • ¥15 网络科学导论,网络控制
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)