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

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日

悬赏问题

  • ¥80 构建降雨和积水的预测模型
  • ¥15 #Qt Transform setTransform()在鼠标拖动移动视角是一致在原地不动,无法变换视角(细微观察似乎视图有在原地抖动),无法变换视角(细微观察似乎视图有在原地抖动)
  • ¥50 如何利用无人机拍摄的数码照片测量鸟卵的长短径
  • ¥100 github贡献者给与奖励
  • ¥15 使用DS18B20+ESP8266获取温度数据返回-127.00
  • ¥15 odbc代码新增sqlserver数据源
  • ¥15 求一个USB指纹识别的驱动
  • ¥15 wps中工作表与工作表之间怎么汇总信息?
  • ¥50 请教Windows server 2012 R2的DCOM配置问题
  • ¥15 adasis v3中LaneConnectivity