Components are not getting created under objectType

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

Moderator: uasdknet

Post Reply
avinash00721
Jr. Member
Jr. Member
Posts: 1
Joined: 04 Mar 2019, 16:05

Components are not getting created under objectType

Post by avinash00721 »

I have made an OPC UA server and generated the identifier and XML file with the help of UA Modeler application. In the project I have created one BaseObject Type and under that two more subtypes Under one subtype I have created methods, variables, and objects and on another subtype, I did not created any method and variable. I want to create the method with the help of function createmethodsettings in my nodemanager class but when i am trying to create the method from the code i am getting error bad parentnodeid exists. I have checked with debug and under that i am able to get my subtype id and i tried to convert it to nodeId and assign it as my parentnodeId for my new method that i want to generate under my objecttype. I do not want to create the method from UA modeler instead directly from the code, please look at my code below and tell me the solution and reason behind it and also find the attach screeenshots.

var CreatePPNodeId = yourorganisation.PA.ObjectTypeIds.SystemProjectType;
var CC = CreatePPNodeId.ToNodeId(new NamespaceTable(base.NamespaceUris));

MethodSettings = new CreateMethodSettings()
{
ParentNodeId = CC,
ParentAsOwner = true,
BrowseName = new QualifiedName("CreateParticipantProject", TypeNamespaceIndex),
DisplayName = new LocalizedText("CreateParticipantProject"),
ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.HasComponent,
ModellingRuleId = UnifiedAutomation.UaBase.ObjectIds.ModellingRule_Mandatory,
};

CreateMethod(Server.DefaultRequestContext, MethodSettings);

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

Re: Components are not getting created under objectType

Post by Support Team »

Hello,

You need to specify a RequestedNodeId in the CreateMethodSettings. Please make sure that the NamespaceIndex of the RequestedNodeId is the TypeNamespaceIndex.
Best regards
Unified Automation Support Team

Post Reply