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

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日

悬赏问题

  • ¥25 大学xml问答,会的请回复
  • ¥15 小贝360-4 配二个 华772S 设置WⅰFi5G 连接
  • ¥15 vs2022的QT报错,好像是缺少winextras
  • ¥15 怎么看 cst中一个面的功率分布图
  • ¥15 c语言数据结构求9999
  • ¥15 Fiddler无法对部分小程序抓包
  • ¥60 Python代码 ip首部检验和计算代码 版本协议 首部长度 源地址 目的地址 存活时间
  • ¥18 微机原理汇编的综合实验
  • ¥15 LD衰减图用R语言对其可视化
  • ¥15 Mermaid语法生成的svg在Axure无法编辑