15:15, EEST
April 12, 2016
I 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
Moderators
April 17, 2013
Hello,
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!
Most Users Ever Online: 518
Currently Online:
12 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
hbrackel: 135
pramanj: 86
Francesco Zambon: 81
rocket science: 77
Ibrahim: 76
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
fred: 41
Member Stats:
Guest Posters: 0
Members: 683
Moderators: 16
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1467
Posts: 6261
Newest Members:
digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPoomaModerators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5
Administrators: admin: 1