UaExpert shows "BadNodeIdUnknown" as value although value is received from server app

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
User avatar
h2k_toy
Sr. Member
Sr. Member
Posts: 14
Joined: 24 Sep 2020, 09:13

UaExpert shows "BadNodeIdUnknown" as value although value is received from server app

Post by h2k_toy »

Hello,

after i failed with my simplest example i can imagine, my 2nd approach: now i do it the same way as Lesson03:

I created a model that defines a type "WeldDevice" and create an object of that type in the code of the ua server.

In the startup method of my NodeManager class i write:

Code: Select all

          
            this.InstanceNamespaceIndex = this.AddNamespaceUri("www.mycompany.com/Gws2UaWeldDeviceServer/dynamic");

            var aWeldDevicesSettings = new CreateObjectSettings()
            {
                ParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder,
                ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
                RequestedNodeId = new NodeId("WeldDevices", this.InstanceNamespaceIndex),
                BrowseName = new QualifiedName("WeldDevices", this.InstanceNamespaceIndex),
                TypeDefinitionId = UnifiedAutomation.UaBase.ObjectTypeIds.FolderType
            };
            var aWeldDevicesObjectNode = this.CreateObject(Server.DefaultRequestContext, aWeldDevicesSettings);

            CreateObjectSettings aWeldDeviceSettings = new CreateObjectSettings()
            {
                ParentNodeId = new NodeId("WeldDevices", this.InstanceNamespaceIndex),
                ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
                RequestedNodeId = new NodeId("DefaultWeldDevice", this.InstanceNamespaceIndex),
                BrowseName = new QualifiedName("DefaultWeldDevice", this.TypeNamespaceIndex),
                TypeDefinitionId = new NodeId(ObjectTypes.WeldDevice, this.TypeNamespaceIndex)
            };
            var aWeldDeviceObjectNode  = this.CreateObject(Server.DefaultRequestContext, aWeldDeviceSettings);

            var aCauseBadNodeIdErrorInUaExpert = true;
            if (aCauseBadNodeIdErrorInUaExpert)
            {
                var aJobNumberVariableNode = this.SetVariableConfiguration(
                                                new NodeId("DefaultWeldDevice", this.InstanceNamespaceIndex),
                                                new QualifiedName("JobNumber", this.TypeNamespaceIndex),
                                                NodeHandleType.ExternalPolled,
                                                "MyUserData"
                                                );
                if(aJobNumberVariableNode.IsNullReference())
                {
                    throw new InvalidOperationException();
                }
            }
            
The type 'WeldDevice' has one variable as UInt32 "JobNumber".

Ok: The tree including the leaf node "JobNumber" is properly shown in the UaExpert.
Ok: when i click it, the ua library receives the value from my code via:

Code: Select all

 
 public override DataValue ReadAttribute(RequestContext aRequestContext, NodeAttributeHandle aNodeHandle)
 {
            if( object.Equals(aNodeId.Identifier.ToString(), "DefaultWeldDevice.JobNumber"))
            {
                // This code is executed.
                return new DataValue(new Variant((UInt32)1));
            }
            else
            {
                return base.ReadAttribute(aRequestContext, aNodeHandle);
            }            
 }
NotOk: But the UaExpert shows as Value Status BadNodeIdUnknown (0x80340000)

What's wrong here? I mean the node is displayed and the value is requested and returned. actually everthing should be right then.

When i set aJobNumberVariableNode = false the value is still requested, the error disappears but still it displays not 1 as returned but a 0.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: UaExpert shows "BadNodeIdUnknown" as value although value is received from server app

Post by Support Team »

Hello,

You are overriding the wrong method. Please implement either the Reas-Method that is implemented in ServerGettingStarted (http://documentation.unified-automation.com/uasdkdotnet/3.0.5/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#a9c568d43548cdbeaf29179965eaad8cd) or the Read-Method that is implemented in the DemoServer (http://documentation.unified-automation.com/uasdkdotnet/3.0.5/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#a4121de459e7f3f7260d57e158c85d9c6).
Best regards
Unified Automation Support Team

User avatar
h2k_toy
Sr. Member
Sr. Member
Posts: 14
Joined: 24 Sep 2020, 09:13

Re: UaExpert shows "BadNodeIdUnknown" as value although value is received from server app

Post by h2k_toy »

Ok thanks. This was the answer to the other problem, i think this problem remained after i fixed it.

The solution was that i had wrong node ids. It took a while for me to understand that there is a node in the typedefinition and a node for the variable instance. This confusion brought me to pass wrong node ids.

I now can read values and also i can handle the change notification through the ModelChangeEvent.

I think the evaluation is over now and we will buy the license. Thanks for your help.

Post Reply