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 method node from client side and how we describe its input and output arguments
April 20, 2016
19:47, EEST
Avatar
khalid_shah
Member
Members
Forum Posts: 6
Member Since:
April 12, 2016
sp_UserOfflineSmall Offline

I want to create a method node but it,s not working . my code is below
NodeId parentNode=MyObjects; // its a folder
NodeId typeDefinition=null;
NodeClass nodeClass=NodeClass.Method;
NodeAttributes nodeAttributes=null;
MethodAttributes methodAttributes = new MethodAttributes();
methodAttributes .setDescription(LocalizedText.english(“I am a method type “));
methodAttributes .setSpecifiedAttributes(NodeAttributesMask.getMask(
NodeAttributesMask.Description,
NodeAttributesMask.DisplayName,
NodeAttributesMask.UserWriteMask,
NodeAttributesMask.WriteMask));
methodAttributes .setUserWriteMask(UnsignedInteger.ONE);
methodAttributes .setWriteMask(UnsignedInteger.ONE);
methodAttributes .setExecutable(true);

nodeAttributes=methodAttributes ;
String name=”myMethod”;
String NameSpaceIndex=2;
NodeId newNodeId = new NodeId(NameSpaceIndex,name);
QualifiedName browseName=new QualifiedName(NameSpaceIndex,name);
Id = client.getAddressSpace().addNode(
parentNode,
Identifiers.HasComponent,
newNodeId,
browseName,
nodeClass,
nodeAttributes,
typeDefinition);
its not working it throws a exception
com.prosysopc.ua.ServiceException: ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: com.prosysopc.ua.server.UaInstantiationException: Could not get type node.
at com.prosysopc.ua.server.NodeManagerUaNode.createNodeBuilder(Unknown Source)
at com.prosysopc.ua.server.NodeManagerUaNode.createNodeBuilder(Unknown Source)
at com.prosysopc.ua.server.NodeManagerUaNode.createInstance(Unknown Source)
at com.prosysopc.ua.server.NodeManagerUaNode.createInstance(Unknown Source)
at server.MyNodeManager.addNode(MyNodeManager.java:542)
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)

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)
***
*
*
*
*
*
*
*
*
*\
*
*
*
i also tried with typedefination = Identifiers.MethodNode;
Id = client.getAddressSpace().addNode(
parentNode,
Identifiers.HasComponent,
newNodeId,
browseName,
nodeClass,
nodeAttributes,
Identifiers.MethodNode);
it also not working…
**
*
*
*
*
*
*\
*
*
i also tried with this call

AddNodesItem item = new AddNodesItem(client.getNamespaceTable().toExpandedNodeId(parentNode),
referenceTypeId,
client.getNamespaceTable().toExpandedNodeId(newNodeId),
browseName,
nodeClass.Method,
ExtensionObject.binaryEncode(nodeAttributes, client.getEncoderContext()),
ExpandedNodeId.NULL);
Id = client.getAddressSpace().addNode(item);
Its also not working … 🙁 🙁
what should i do now ??

these all methods throw same exception 🙁
CryCryCry

April 21, 2016
17:12, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

I guess I should have been more specific in my answer to http://forum.prosysopc.com/for…..iton-node/ .

The NodeManagerUaNode.createInstance works only when the NodeId/ExpandedNodeId/class defines a (ua) type, because it creates instances of that type. Therefore you need to change the override I described in the link above to call super.createNodeForAddNode if the typeDefnitionId is null,(or call getNodeFactory().createNode(nodeClass, nodeId, browseName, displayName, typeDefinitionId) which is what it does by default).

In case you want, could you describe the use case for client side created Method nodes? I’m just curious as this is the first time I have seen anyone trying to add method nodes from the client side (well anyway even using the AddNodes service is not that common) because unless you also dynamically handle calling of that method it does nothing (you could handle it dynamically similar to how MyMethodManagerListener example does in the samples and add different handling as you add the nodes, but still I’m not aware of any existing use cases of this Smile ).

– Bjarne

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
17 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