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

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日

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条