Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_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: 1047
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

It is related to a security fix done in 4.11.0: https://downloads.prosysopc.co…..ion-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:
Guest(s) 31
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 90
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 733
Moderators: 8
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1545
Posts: 6519
Newest Members:
ptdenriqueta, basilpullman, Richardmip, mood edibles, LouieWreve, daniellabdx, janessan21, sammiebeak359, gena7127517, thorstenbouldin
Moderators: Jouni Aro: 1029, Pyry: 1, Petri: 1, Bjarne Boström: 1047, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0, Elias: 0
Administrators: admin: 1