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
Read Attributes from OPCUA Server
September 19, 2018
21:28, EEST
Avatar
carlos.gonzalez
Member
Members
Forum Posts: 12
Member Since:
August 7, 2018
sp_UserOfflineSmall Offline

Hi,

I am having problems to read the value of specific node, this is from Server side.

I am sending “myNodeManager” like parameter to other class when I am going to make the call, this is the code:

IoManagerUaNode ioManagerUaNode = new IoManagerUaNode(myNodeManager);
NodeId nodeIdName = new NodeId(2,”Name”); //This is the node I am going to read the value, and it has value!!
try {
DataValue data = ioManagerUaNode.readAttribute(nodeIdName, Attributes.Value, null, null);
String name = data.getValue().toString();
System.out.println(name);
} catch (StatusException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

But, I am getting this error:
ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: java.lang.NullPointerException
at com.prosysopc.ua.server.IoManagerUaNode.readValue(SourceFile:119)
at com.prosysopc.ua.server.IoManager.readAttribute(SourceFile:870)
at com.prosysopc.ua.server.IoManager.readAttribute(SourceFile:439)

I am getting null value, but the node has value!

I was looking the documentation and there is others methods like readValue or other readAttribute (with more parameters) but I can not see them on my IoManager.

Thank you.

September 20, 2018
13:03, EEST
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

I/O managers are used to handle read and write calls from the client applications. It’s not supposed to be used internally by the server application.

In the context of the example above, where you already have access to the NodeManagerUaNode object (myNodeManager), you can access the UaNode objects by calling

NodeManagerUaNode.findNode(NodeId nodeId);

If you would not have access to the NodeManager object, you could also call getNode method of the NodeManagerTable:

UaServer.getAddressSpace().getNode(NodeId nodeId);

You can then access the different attributes of the node with getXxx methods. As an example, the DataValue of the value attribute can be obtained with getValue() method. As a more complete example, please see the below code for obtaining the value attribute in the above scenario:

CacheVariable nameNode= (CacheVariable) myNodeManager.findNode(new NodeId(2,"Name"));
DataValue dv = nameNode.getValue();

All this being said, the server side SDK documentation might need some improvement regarding these aspects. You can find documentation about these methods in the Javadoc, but the tutorial documents don’t offer much help.

September 20, 2018
18:45, EEST
Avatar
carlos.gonzalez
Member
Members
Forum Posts: 12
Member Since:
August 7, 2018
sp_UserOfflineSmall Offline

Hi,

Ok, I will use getValue() method instead IoManager.

Thank you so much for your quickly response!!

Regards.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 75

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 685

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1466

Posts: 6256

Newest Members:

Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule, rashadbrownrigg, christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer

Moderators: Jouni Aro: 1009, 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: 320, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1