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
OPC UA method: how to manage the result
February 20, 2023
13:35, EET
Avatar
Francesco Zambon
Member
Members
Forum Posts: 81
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Good morning,

I have to convert my Java SOAP web services into OPC UA methods.

Use case 1:
Java method:
public void insertMaterial (String Code, Double Density);

Return:
– Return ok (the material has been added in the system)
– Return error due to:
Code is null
Code is already present in the system
Density is null

Use case 2:
Java method:
public List listMaterial();

Return:
– Return the list of materials
– Return error (server error)

I thought of creating a new structure:
ReturnType definition:
Returncode – 0:Uint32 (0 = OK, 1 = Error)
ReturnDescription – 0:String (additional informations / error description)

And eventually returns multiple output arguments (OPC UA standard allows you to return multiple results):

Use case 1:
Java Method:
public void insertMaterial (String Code, Double Density);

OPC UA output arguments:
– Arguments 0: ReturnType

Use case 2:
Java Method:
public List listMaterial();

OPC UA output arguments:
– Arguments 0: Returnype
– Arguments 1: Materials (xml string)

Is there a best practice to manage methods output arguments?

The EUROMAP 86 standard (https://www.euromap.org/euromap86) defines:
3.2.6 Resultcode
The Resultcode Gives Information About Each In-Parameter of a Method and Is Given by the Mss. It´s Formatted in a binary code:
– 0: ok
– 1: nok
3.2.7 Resultttext
The Resultttext

Example for a Resultcode with 2 materialids:
MSB -> 001010 msscomponentsids [0] = 7; Is Nok (E.G. Materialid is not listed)
0 -> msscomponentsids [1] = 2; is ok
1 -> msscomponentspercentage [0] = 110; Is Nok (E.G. Perntage> 100%)
0 -> msscomponentspercentage [1] = 25; is ok
MSB 0 -> Recipeid is ok

But this solution does not convince me. I would prefer to work with the structures and not with the binary encoded variables.

Best regards,
Francesco

February 21, 2023
8:45, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 321
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

If I understood properly, you are implementing custom Methods that are not part of any pre-existing information model, is that correct? If you are, then there is nothing stopping you from choosing the solution that fits your application the best. If you want the outputs of a Method be a single Structure, then you could do that. But since Methods can have multiple outputs, you could also have the Method return multiple simple DataTypes and avoid having the Clients need to process the Structures.

I’m not familiar with the EUROMAP 86 standard or EUROMAP standards in general, so I don’t know the background for the ResultCode concept. It does have the advantage that it can be used in any sort of Method with 32 or less input arguments. It’s major disadvantage is that programming against it requires knowing exactly how the bits correspond to the input arguments.

Unless you need to have the Method outputs consume as little bandwith as possible, I would personally prefer Method outputs that are descriptive and easy to process. If you’re interested in how Values of different DataTypes are encoded when they’re transmitted between Clients and Servers, take a look at the Data Encoding section of the OPC UA Specification Part 6: https://reference.opcfoundation.org/Core/Part6/v105/docs/

February 21, 2023
10:35, EET
Avatar
Francesco Zambon
Member
Members
Forum Posts: 81
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Dear Matti,

Thank you. You have been very clear.

I’m designing a new information model so I can define my own methods.

Best regards,
Francesco

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

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

Administrators: admin: 1