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
Error while reading Nodes
July 28, 2015
11:11, EEST
Avatar
maxpermsize
Member
Members
Forum Posts: 4
Member Since:
July 28, 2015
sp_UserOfflineSmall Offline

Hello,

i’m running the sources of the SampleConsoleClient to evaluate the SDK. I can connect my Client to my OPC UA Server (Softing OPC UA). If i want to read a System-Item of the Server, the following Error occures:
Exception in thread “main” com.prosysopc.ua.StatusException: Bad_WaitingForInitialData (0x80320000) “Waiting for the server to obtain values from the underlying data source.” StatusCode=Bad_WaitingForInitialData (0x80320000) “Waiting for the server to obtain values from the underlying data source.”

If i use a custom Application (Based on the public UA-Stack) it works fine.
Can anybody help me? Confused

July 29, 2015
12:14, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

That statuscode is returned by the server usually to indicate that it does not yet have a value for that attribute. That is not an Error, the way the SDK handles non-good values (i.e. the statuscode of the value is not good), is by throwing exceptions, which we do catch and print. See e.g. the mainMenu() method in the SampleConsoleClient.

– Bjarne

August 3, 2015
13:37, EEST
Avatar
maxpermsize
Member
Members
Forum Posts: 4
Member Since:
July 28, 2015
sp_UserOfflineSmall Offline

For sure, this is not an Error. But if i use a custom Application based on UA-Stack, i can read the same item. After reading the Item with the Stack-based Application i can read the Item with the Prosys-SDK, BUT the value and the timestamp never Change. They first Change if i read 2nd time with the Stack-based Application…?

I want to understand how the read-process in the SDK works and what are the differents to the UA-Stack 🙂

August 3, 2015
14:27, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Assuming the SampleConsoleClient, the Read parameters should be a ReadValueId with NodeId and Attribute; IndexRange and DataEncoding are null. Based on the returned ReadResponse:
If response header service result is bad, a ServiceException is thrown
If the result value has bad statuscode a StatusException is thrown
Otherwise, the value is returned

Assuming you are calling yourself with UaClient, if you do read multiple values then only service exceptions are thrown (since the read could success partially).

August 4, 2015
6:34, EEST
Avatar
maxpermsize
Member
Members
Forum Posts: 4
Member Since:
July 28, 2015
sp_UserOfflineSmall Offline

This code works fine:

System.out.println(“start test…”);
Application app = new Application();
app.getApplicationDescription().setApplicationName(appDesc.getApplicationName());
app.getApplicationDescription().setApplicationUri(appDesc.getApplicationUri());
app.getApplicationDescription().setProductUri(appDesc.getProductUri());
app.getApplicationDescription().setApplicationType(appDesc.getApplicationType());
Client stackClient = new Client(app);
SessionChannel myChannel = stackClient.createSessionChannel(client.getEndpoint());
myChannel.activate();

System.out.println(“start test-read…”);
NodeId id = new NodeId(3, “_System.Heartbeat”);
ReadRequest wannaRead = new ReadRequest();
ReadValueId readValue = new ReadValueId();
readValue.setAttributeId(Attributes.Value);
readValue.setIndexRange(null);
readValue.setDataEncoding(QualifiedName.NULL);
readValue.setNodeId(id);
wannaRead.setNodesToRead(new ReadValueId[] { readValue });
System.out.println(myChannel.Read(wannaRead));

The ApplicationDecription is the same – DataEncoding + IndexRange too (null-Values)
Do you see some differents to the Prosys-Stack Implementation?

August 4, 2015
9:35, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

I guess I could try to clarify. There are 2 parts. The SDK and the stack. The SDK is build on top of the stack. The stack which is part of the SDK download archive “is the same” as OPC Foundation’s. We do sometimes maintaining work/new features to it. This means the stack in the download archive is built by us, but it is mostly the same; there might be some bugfixes/features not yet in the foundation version, but for other parts it is the same. Because the SDK works on top of the stack, i.e. is also higher level, it is not that easy see what the lowlevel request we make (since there are many ways you can e.g. call Read).

Reading the Objects/MyOBjects/MyDevice/MyLevel Value attribute (In SampleConsoleServer or Simulation Server) is at least the following:

ReadRequest
RequestHeader=RequestHeader
AuthenticationToken=i=3828519905
Timestamp=08/04/15 09:23:00.4970000 GMT
RequestHandle=234
ReturnDiagnostics=0
AuditEntryId=null
TimeoutHint=30000
AdditionalHeader=null
MaxAge=2.147483647E9
TimestampsToReturn=TimestampsToReturn
name=Both
ordinal=2
NodesToRead=ReadValueId[1]
[0]=ReadValueId
NodeId=ns=2;s=MyLevel
AttributeId=13
IndexRange=null
DataEncoding=null

So for the ReadValueId part it is the same.

Do you have the issue with any other server?

August 4, 2015
10:08, EEST
Avatar
maxpermsize
Member
Members
Forum Posts: 4
Member Since:
July 28, 2015
sp_UserOfflineSmall Offline

The Problem only occures with the Softing OPC-Server. With the Prosys Demo-Server, everything is fine

March 26, 2018
14:47, EEST
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

If somebody experiences this same issue in the future, it should be noted that the issue happens with certain Softing OPC UA servers when the server side cache is not initialized and the client issues a ReadRequest with a large maxAge parameter.

The default maxAge parameter value used in the Prosys OPC UA Java SDK is Integer.MAX_VALUE (2147483647).

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
14 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: 729

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala

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

Administrators: admin: 1