0

我正在使用节点 OPC-UA 客户端并收到以下错误

Error: cannot  coerce value=4 to Enum
at _decode_enumeration (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-factory/src/factories_enumerations.js:52:23)
at UserTokenPolicy.decode (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-service-endpoints/_generated_/_auto_generated_UserTokenPolicy.js:139:22)
at /Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-service-endpoints/_generated_/_auto_generated_EndpointDescription.js:181:12
at exports.decodeArray (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-basic-types/src/array.js:40:18)
at EndpointDescription.decode (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-service-endpoints/_generated_/_auto_generated_EndpointDescription.js:179:31)
at /Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-service-endpoints/_generated_/_auto_generated_GetEndpointsResponse.js:105:12
at exports.decodeArray (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-basic-types/src/array.js:40:18)
at GetEndpointsResponse.decode (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-service-endpoints/_generated_/_auto_generated_GetEndpointsResponse.js:103:22)
at MessageBuilder._safe_decode_message_body (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-secure-channel/src/message_builder.js:403:20)
at MessageBuilder._decode_message_body (/Users/xxx/apps/node-opcua-sample/node_modules/node-opcua-secure-channel/src/message_builder.js:450:18)

我一直在将此 opc UCA ( https://github.com/node-opcua/node-opcua ) 用于其他 ocpUA 服务器,它们工作正常。

UserTokenPolicy 令牌似乎有问题,但它不是应该默认匿名登录吗?可能是什么其他问题?

请注意,它适用于 prosys opcua 客户端。

4

1 回答 1

1

看起来node-opcua 还不支持UserIdentityTokenType = 4 ...

const EnumUserIdentityTokenType_Schema = {
  name: "EnumUserIdentityTokenType",
  enumValues: {
    ANONYMOUS: 0,
    USERNAME: 1,
    CERTIFICATE: 2,
    ISSUEDTOKEN: 3
  }
};

OPC 规范 1.04 也仅指定了4 个可能的值,从 0 到 3

<opc:EnumeratedType Name="UserTokenType" LengthInBits="32">
   <opc:Documentation>The possible user token types. 
   </opc:Documentation>
  <opc:EnumeratedValue Name="Anonymous" Value="0" />
  <opc:EnumeratedValue Name="UserName" Value="1" />
  <opc:EnumeratedValue Name="Certificate" Value="2" />
  <opc:EnumeratedValue Name="IssuedToken" Value="3" />
</opc:EnumeratedType>

请在https://github.com/node-opcua/node-opcua中提出问题并提供详细说明以重现该行为

于 2018-10-31T12:46:23.810 回答