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
Method Create for Object Types Specification Part 10
July 21, 2017
9:27, EEST
Avatar
kapsl
Member
Members
Forum Posts: 57
Member Since:
December 20, 2016
sp_UserOfflineSmall Offline

Hi,
we wanted to use the possibility to create an Instance of an ObjectType, by calling the Create() Method as described in the OPC UA Specification Part 10:

“In addition to the AddNodes Service ObjectTypes may have a special Method with the BrowseName “Create”. This Method is used to create an Object of this ObjectType. This Method may be useful for the creation of Objects where the semantic of the creation should differ from the default behaviour expected in the context of the AddNodes Service. For example, the values should directly differ from the default values or additional Objects should be added, etc. The input and output arguments of this Method depend on the ObjectType; the only commonality is the BrowseName identifying that this Method will create an Object based on the ObjectType. Servers should not provide a Method on an ObjectType with the BrowseName “Create” for any other purpose than creating Objects of the ObjectType.”

When we used the codegenerator the onCreate() Method is generated. But when I try to execute the method by UaExpert, this method is not triggered and I get an BadMethodInvalid Error…

lg Manu

July 21, 2017
11:05, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Unfortunately, there is no built-in support for the Create method in the SDK (I am not even sure what would be the correct way to do it, actually).

The problem is that the method is expected to be in the type (only). The code generator generates Java classes and when you instantiate objects from these classes, you get the methods linked in to the instances and there is code that can be executed (in the Java object) when the client application makes the method call. The method call is always expected to happen in a context of an object, instead of a type.

If you wish to implement a method in the type, you will have to plug the method implementation manually into the type node, as in your previous issue.

So, actually I think it is better to add the method to the type only in your code, instead of in UaModeler. If you define it in UaModeler, you should define the method with ModellingRule=None. Otherwise it will end up to all instances of this type, too, which is not desired, I guess.

Of course, the ModellingRule=None would enable us to generate code for a ‘static’ method in the type; We will need to see if it that would be a viable solution for implementing this type of methods in future versions of the SDK.

Thanks for bringing this out!

BTW: The Create method is described in Specification Part 3: 5.5.4.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
12 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: 730

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof

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

Administrators: admin: 1