the following code throws an exception at the commented line.
Code: Select all
{
ObjectNode aObjectNode1;
ObjectNode aObjectNode2;
var aNodeManager = this;
var aServer = aNodeManager.Server;
var aNamespaceIndex = aNodeManager.DefaultNamespaceIndex;
var aRequestContext = aServer.DefaultRequestContext;
var aTypeDefinitionId = UnifiedAutomation.UaBase.ObjectTypeIds.FolderType;
{
var aParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder;
var aEigenschaftName = "Root";
var aBrowseName = new QualifiedName(aEigenschaftName, aNamespaceIndex);
var aCreateObjectSettings = new CreateObjectSettings()
{
ParentNodeId = aParentNodeId,
ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
TypeDefinitionId = aTypeDefinitionId,
BrowseName = aBrowseName,
};
var aObjectNode = aNodeManager.CreateObject(aRequestContext, aCreateObjectSettings);
aObjectNode1 = aObjectNode;
}
{
var aParentNodeId = aObjectNode1.NodeId;
var aEigenschaftName = "Root";
var aBrowseName = new QualifiedName(aEigenschaftName, aNamespaceIndex);
var aCreateObjectSettings = new CreateObjectSettings()
{
ParentNodeId = aParentNodeId,
ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
TypeDefinitionId = aTypeDefinitionId,
BrowseName = aBrowseName,
};
var aObjectNode = aNodeManager.CreateObject(aRequestContext, aCreateObjectSettings);
aObjectNode2 = aObjectNode; // throw exception "BadParentNodeIdInvalid"
}
}
But the second call to createObject fails with BadParentNodeIdInvalid.
I guess the framework can not handle node ids if it's a guid one? Am i right?
If this is true my next question would be: What node ids shall i use if the server's tree is built dynamically? I don't have a model that defines node ids.
Is the value range starting from 6000... ? for custom nodes or how shall i proceed? I have a unique number for the server's node of type int available. (For instance nodes, not for type nodes) May i just add 6000 to this number?
Or (idea before i leave here) can i just choose any int number if i register a new namespace?
Thanks!