Topic RSS15:15, EEST
April 12, 2016
OfflineI want to add a type definition node from client side by using the following code:
NodeId typeDefinition=null;
NodeClass nodeClass=NodeClass.ObjectType;
NodeId parentNode=Identifiers.RootFolder; // or i also check with parentNode = BaseObjectType which is defined in root->types->ObjectTypes->BaseObjectType
NodeId referenceTypeId=Identifiers.HasSubType;
NodeAttributes nodeAttributes=null;
ObjectAttributes objectAttributes=new ObjectAttributes();
objectAttributes.setDescription(LocalizedText.english(“I am a Object Node”));
objectAttributes.setSpecifiedAttributes(UnsignedInteger.ONE);
objectAttributes.setUserWriteMask(UnsignedInteger.ONE);
objectAttributes.setWriteMask(UnsignedInteger.ONE);
nodeAttributes= objectAttributes;
NodeId newNodeId = new NodeId(2,name);
QualifiedName browseName=new QualifiedName(2,”name”);
nodeAttributes.setDisplayName(new LocalizedText(“name”));
NodeId Id = client.getAddressSpace().addNode( parentNode,
referenceTypeId,
newNodeId,
browseName,
NodeClass.ObjectType,
nodeAttributes,
typeDefinition);
i am creating a object type definition node…. for adding any object or variable node i specify its typedefinition node that is already present in my address space ……. but if i want to add a node that is itself a TYPEDEFINITION node , so i send the typeDefinition parameter as null which gives error on server side
com.prosysopc.ua.StatusException: Bad_TypeDefinitionInvalid (0x80630000) “The type definition node id does not reference an appropriate type node.” StatusCode=Bad_TypeDefinitionInvalid (0x80630000) “The type definition node id does not reference an appropriate type node.”
at com.prosysopc.ua.server.NodeManagerUaNode.addNode(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.addNode(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.addNode(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.addNode(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.addNodes(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.onAddNodes(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition$1.serve(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition.serve(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerSecureChannel.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection$4.onMessageComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.fireComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.setMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
16:19, EEST
April 17, 2013
OfflineHello,
This seems to be a bug in the SDK. Fortunately, you should be able to bypass this issue easily.
Try using the AddressSpace.addNode(AddNodesItem node) method.
referenceTypeId, client.getNamespaceTable().toExpandedNodeId(newNodeId), browseName,
NodeClass.ObjectType, ExtensionObject.binaryEncode(nodeAttributes, client.getEncoderContext()),
ExpandedNodeId.NULL);
NodeId id = client.getAddressSpace().addNode(item);
Let us know if this fixes the issue for you. This is something that we need to look into and fix in the next release.
Anyway, thanks for reporting this!
1 Guest(s)

Log In
Register
