Login  •  Register


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 ...

Components are not getting created under objectType

Postby avinash00721 » 06 Mar 2019, 14:20

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);
avinash00721
Newbie
Newbie
 
Posts: 1
Joined: 04 Mar 2019, 16:05

Re: Components are not getting created under objectType

Postby Support Team » 31 May 2019, 15:53

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
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2407
Joined: 18 Mar 2011, 15:09


Return to .NET based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests