Hello together,
I have very specific question regarding the creation of a OPC UA method using "CreateMethodSettings" in code.
I set the browse name and NodeId of method itself.I add input and output arguments. In addition to the method node, there are variable nodes created with BrowseName and DisplayName "InputArguments" and "OutputArguments".
The node id of these variable nodes do have IdentifierType "Guid". Thats a problem for our clients (e.g. Siemens PLC) to consume.
How can I change the IdentifierType of the "InputArguments" / "OutputArguments" nodes from Guid to String?
Thanks in advance!
Sleepy-Simon89
OPC UA method creation in code
Moderator: uasdknet
- Support Team
- Hero Member
- Posts: 3220
- Joined: 18 Mar 2011, 15:09
Re: OPC UA method creation in code
Hi,
first, it is very important to understand that a Client has no choice and must support all the different types of NodeIDs as specified by the OPC UA standard. The Server can offer whatever he preferes, but the Client must support all of them.
When adding a method using the CreateMethod method, the NodeIds for the InputArguments and OutputArgument properties are GUID NodeIds by default. By overriding the Method CreateNodeId you can set the NodeIds for newly created nodes.
Here is a sample implementation.
See also: https://documentation.unified-automation.com/uasdknet/4.1.0/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#abf3f2c6b58e79017ae81bf1edd90f40c
first, it is very important to understand that a Client has no choice and must support all the different types of NodeIDs as specified by the OPC UA standard. The Server can offer whatever he preferes, but the Client must support all of them.
When adding a method using the CreateMethod method, the NodeIds for the InputArguments and OutputArgument properties are GUID NodeIds by default. By overriding the Method CreateNodeId you can set the NodeIds for newly created nodes.
Here is a sample implementation.
Code: Select all
protected override NodeId CreateNodeId(NodeId parentNodeId, QualifiedName browseName, NodeClass nodeClass, ushort namespaceIndex)
{
if (parentNodeId != null
&& (browseName == new QualifiedName(BrowseNames.InputArguments) || browseName == new QualifiedName(BrowseNames.OutputArguments)))
{
return new NodeId($"{parentNodeId.Identifier}.{browseName.Name}", namespaceIndex);
}
return base.CreateNodeId(parentNodeId, browseName, nodeClass, namespaceIndex);
}
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Full Member
- Posts: 8
- Joined: 18 May 2020, 15:17
Re: OPC UA method creation in code
Thanks a lot. It is working.
I know that client must support all identifier types. But unfortunately I have no influence on the implementation of the clients and need to get the connection running. So I have no other chance than modifying the behavior of my OPC UA server. I know wrong system to fix the issue but sometimes it's the only way to get it working.
I know that client must support all identifier types. But unfortunately I have no influence on the implementation of the clients and need to get the connection running. So I have no other chance than modifying the behavior of my OPC UA server. I know wrong system to fix the issue but sometimes it's the only way to get it working.