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
Return DiagnosticInfo from Method call (on the Server)
September 20, 2024
13:30, EEST
Avatar
hbrackel
Member
Members
Forum Posts: 144
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

I have an OPC UA Server using generated code for an object containing multiple methods. In case of e.g. bad method arguments, I would like to provide extra information to the client about the error using DiagnosticInfo.

using Kotlin…

onMyMethod() {
….
val msg = "Some error explanation"…
val di = DiagnosticInfo().apply { additionalInfo = msg }
throw StatusException(StatusCodes.Bad_InvalidState, di)
}

I thought that this had worked e.g. using UaExpert in the past, but right now (sdk 5.2.2) UaExpert returns the StatusCode and the message
“Please see AdditionalInfo for a detailed description of the error”

Setting the additionalInfo in other SDKs works as expected.

How can I convey the extra message back to the client (show in UaExpert)?

September 20, 2024
15:06, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1017
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

It is related to a security fix done in 4.11.0: https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_4_Release_Notes.html#version-4-11-0, relevant part copied below:

“… security fix limits extra info in OPC UA TCP ErrorMessage and in the ResponseHeader(s) returned with any ServiceResponse. Now by default they do not anymore contain any additional info nor stacktraces of any Exceptions that would occured within the processing of the ServiceRequest. We are not aware of any attack scenarios where this information could be used, but it could potentially be useful for an attacker. The fix disables the functionality of ErrorMessage.setReason(String) and DiagnosticInfo.setAdditionalInfo(String) unless flags ErrorMessage.disableReasonField and/or DiagnosticInfo.disableAdditionalInfo are set to false (default true). The disableAdditionalInfo also omits the StringTable of the ResponseHeader when built from an Exception. Future SDK versions might offer more granular control.

Note that without the above SDK will use the AdditionalInfo already by itself in most cases for the stacktrace. The one you are trying to use might be one of the few that could allow putting custom text there. But we do not yet offer any “more granular control” for this.

September 20, 2024
15:34, EEST
Avatar
hbrackel
Member
Members
Forum Posts: 144
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

Thank you very much for yourquick response. Setting DiagnosticInfo.disableAdditionalInfo = false before starting the server provides the desired behaviour.

Thanks,
Hans-Uwe

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 86

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 734

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1510

Posts: 6399

Newest Members:

tammyhillier, rodsFioravanti, Sairamreddy, wj, valentinafluhart, accusneds, Jamesses, DavidLarry, elainesever, powhephenry

Moderators: Jouni Aro: 1019, Pyry: 1, Petri: 0, Bjarne Boström: 1017, Jimmy Ni: 26, Matti Siponen: 340, Lusetti: 0

Administrators: admin: 1