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
Is it possible to add the additional header to service requests?
June 23, 2018
10:48, EEST
Avatar
Luke.d
Member
Members
Forum Posts: 8
Member Since:
February 21, 2018
sp_UserOfflineSmall Offline

Hi,
Is it possible through your SDK to create and add messages in the additional Header of service requests? (Specifications OPC-UA 1.04 part 4, table 170 [page 146].

If it were possible, could you give me an example?

I only need to write a basic type of data.

Thanks in advance,
Best regards.

Luke

June 25, 2018
9:32, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

If possible, could you first give a use-case where this would be needed?

That specification part lists the addtionalHeader as:
“Reserved for future use.
Applications that do not understand the header should ignore it.”

In practice this means you should not use it. A future version of the specification could use it, but using it for other purposes than what the specification would specify is not interoperable and would break if a future version decides to use the header.

If you use the UaClient.serviceRequest or .serviceRequestAsync to send a raw ServiceRequest you can set the header as well, but that would ignore most of the API advantages of the SDK.

June 26, 2018
12:21, EEST
Avatar
Luke.d
Member
Members
Forum Posts: 8
Member Since:
February 21, 2018
sp_UserOfflineSmall Offline

Hello,
Thanks for the reply.

I’m a student and I’m doing a project for my university.
I would like to add information to label service requests with a global monotonic counter (longa Value) to handle them in an orderly manner (in Server side).

But I do not think that you can put in the ‘payload’ because it changes for every type of service request.

I do not know if you can use the RequestHandler because I would like to be a global monotic counter for all clients (or is possible to use it?)

The clients all run on the same host.
In this way I could (in special cases) send the service requests in order.

Unfortunately I don’t know if I explained myself well, but is there a way to do this without change paylod of service request?

Thanks.
Best regards,
Luke

June 26, 2018
13:02, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, the RequestHandle should be a monotonically increasing counter, but it may depend on the client applications how it is used. The Java SDK is using it exactly like that on the client side.

The AdditionalHeader would only work with your own clients, anyway.

Or which client applications do you have in mind?

June 26, 2018
14:47, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

If you have only a single client sending request and waiting for a reponse to that before it or any other client does the same again, you can use the same logic I suggested in another thread a while ago: https://forum.prosysopc.com/forum/opc-ua-java-sdk/how-activate-auditing/ (or if order does not matter, then it works without that restriction)

server.getAttributeServiceHandler().setRequestResponseListener(listener);
server.getSessionServiceHandler().setRequestResponseListener(listener);
server.getSubscriptionServiceHandler().setRequestResponseListener(listener);
server.getNodeManagementServiceHandler().setRequestResponseListener(listener);

See the rest of the details of that thread, but it mostly should allow you to have e.g. AtomicLong outside of the listener and “tag” requests and responses to e.g. some map with the counter value being the key. The same logic is used by our Simulation Server for the Req/Res Log view (or well the feature was designed for it to exact).

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
27 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: 707

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1466

Posts: 6253

Newest Members:

christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer, shanonhumphreys, KupimotoblokfuB, tamhollander5, paulinafcf, bridgette18l

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 982, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 319, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1