Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Can't add custom TypeDefinition node from client side
April 12, 2016
15:15, EEST
Avatar
khalid_shah
Member
Members
Forum Posts: 6
Member Since:
April 12, 2016
sp_UserOfflineSmall Offline

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)

April 13, 2016
16:19, EEST
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

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.

AddNodesItem item = new AddNodesItem(client.getNamespaceTable().toExpandedNodeId(parentNode),
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!

April 13, 2016
17:07, EEST
Avatar
khalid_shah
Member
Members
Forum Posts: 6
Member Since:
April 12, 2016
sp_UserOfflineSmall Offline

your suggestion works, my typedefintion node now adds successfully. Thank you so much for your help Smile

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
53 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 738

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1