View Issue Details

IDProjectCategoryView StatusLast Update
000645310000-004: ServicesSpecpublic2023-03-28 15:29
ReporterBjarneBostrom Assigned ToMatthias Damm  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Summary0006453: Call objectId parameter definition contradicts Part 3 definition of Methods (static vs. non-static)
Description

The current text of Part 3 section 4.7. https://reference.opcfoundation.org/v104/Core/docs/Part3/4.7/ says:

"
Methods are “lightweight” functions, whose scope is bounded by an owning (see Note) Object, similar to the methods of a class in object-oriented programming or an owning ObjectType, similar to static methods of a class. Methods are invoked by a client, proceed to completion on the Server and return the result to the client. The lifetime of the Method’s invocation instance begins when the client calls the Method and ends when the result is returned.

NOTE The owning Object or ObjectType is specified in the service call when invoking the Method.

While Methods may affect the state of the owning Object, they have no explicit state of their own. In this sense, they are stateless. Methods can have a varying number of input arguments and return resultant arguments. Each Method is described by a Node of the Method NodeClass. This Node contains the metadata that identifies the Method’s arguments and describes its behaviour.

Methods are invoked by using the Call Service defined in OPC 10000-4.

Clients discover the Methods supported by a Server by browsing for the owning Objects References that identify their supported Methods.
"

Part 4 section 5.11.2.2 on Parameters of the Call service says, for the objectId:
"
The NodeId shall be that of the Object or ObjectType on which the Method is invoked.
In case of an ObjectType the ObjectType or a super type of the ObjectType shall be the source of a HasComponent Reference (or subtype of HasComponent Reference) to the Method specified in methodId.
In case of an Object the Object or the ObjectType of the Object or a super type of that ObjectType shall be the source of a HasComponent Reference (or subtype of HasComponent Reference) to the Method specified in methodId.
See OPC 10000-3 for a description of Objects and their Methods.
"

  • for the methodId parameter:
    "
    NodeId of the Method to invoke.
    If the objectId is the NodeId of an Object, it is allowed to use the NodeId of a Method that is the target of a HasComponent Reference from the ObjectType of the Object.
    "

My (personal) interpretation of the spec is that a Method is either a static (owner is the TypeDefinition node, doesn't have a ModellingRule) or non-static (owner is the instatiated Object node, does have a ModellingRule), but not both. Assuming this interpretation is correct, then the part "NOTE The owning Object or ObjectType is specified in the service call when invoking the Method." plus "Clients discover the Methods supported by a Server by browsing for the owning Objects References that identify their supported Methods." would mean you can either use the ObjectType (for static) or Object (for non-static) as the objectId. Which would contradict the current wording, but would have made sense with the wordings of 1.01 versions of the Call parameters, which just said:
"The NodeIdshall be that of the Objector ObjectTypethat is the
source of a HasComponent Reference(or subtype of
HasComponent Reference) to this Method."
for the objectId parameter.

Thus, I either:

A) The wording on Part 3 must be updated to reflect that there is no longer a concept of "static" Methods or somehow how to determine which methods are as such that they are not allowed to be called from Object instance. For example, the has-ModellingRule-references could be the logic. This matters for code-generating utils, e.g. you might generate static methods to a different place since the instances of the generated class type could e.g. only use the non-static ones (e.g. static methods vs. non-static would be directly translateable to static vs. non-static methods e.g. in Java code).

B) Revert Part 4 to the original 1.01 text. I assume this will not happen.

Probably the change has been made in order to support some Nano Server profiles I would assume? Or servers that wont have a Types section.

Also it is possible, that I have mistanken something plus I should mention that e.g. in Java it is technically possible to call a static method through an java-object-instance, but that in general is bad programming and would result in a compiler warning.

TagsNo tags attached.
Commit Version
Fix Due Date

Activities

Matthias Damm

2021-03-01 13:46

developer   ~0013837

Bjarne,

Can you please provide more information what your essential complain/question is.
Is it (1) or (2)

(1) Two different MethodIds are possible when calling a Method on an Object
This is intentional since clients should be able to use Method NodeIds the know from the type without browsing for the Method NodeId on the instance.

(2) It is not clear if a static method can be called on an instance
I assume that a method is only considered static if it is only on the type and there is no modeling rule. In this case it would not show up at the object instance. if tis shows up on an instance, it is a different Method on the instance.
If a Method has a modeling rule, it is not static.

Jim Luth

2022-09-06 17:07

administrator   ~0017528

No feedback from reporter in over a year.

BjarneBostrom

2022-09-07 13:30

reporter   ~0017538

Sorry, didn't note the need for feedback. Also it is some time since, thus hopefully this is now correct.

For Matthias comments, not really either, but is a combination.

Basically my interpretation of the specification text that I had problems is that one would no longer need to have HasComponent references from the instance nodes to the Method nodes and could simply use them based of the TypeDefinition.

The reason for that is because the text (1.05.00, https://reference.opcfoundation.org/Core/Part4/5.11.2/, the objectId parameter):

"...In case of an Object the Object or the ObjectType of the Object or a super type of that ObjectType shall be the source of a HasComponent Reference (or subtype of HasComponent Reference) to the Method specified in methodId. ..."

is a conflict with the idea that Method node would have a ModellingRule. However, they must have a ModellingRule, because that is the only way to differentiate static vs. non-static methods. However, in turn, IF they do have the ModellingRule, then they are also already present in the instance via the HasComponent, thus there should not be a case where the HasComponent reference is not there AND the Method would have a ModellingRule. And if it doesn't have the ModellingRule, then it is static, thus it cannot be called for the instance by the very concept of it being a static method. Therefore, the text should simply just read:

"...In case of an Object the Object shall be the source of a HasComponent Reference (or subtype of HasComponent Reference) to the Method specified in methodId. ..."

Alternatively some new IsStatic Attribute could be introduced for Method nodes, that would remove the need to have a ModellingRule on them (or alternatively make a rule that ModellingRule works differently for Methods, but please no).

Matthias Damm

2023-03-20 05:13

developer   ~0018904

Last edited: 2023-03-28 15:27

We are not able to make the requested change. Otherwise it would no longer be allowed to used the MethodId from the Method on the Object Type.

The definition may be complicated but it is technically correct and required as it is.

Jim Luth

2023-03-28 15:29

administrator   ~0019044

Agreed to no change required in web meeting.

Issue History

Date Modified Username Field Change
2021-02-02 12:53 BjarneBostrom New Issue
2021-03-01 13:46 Matthias Damm Assigned To => Matthias Damm
2021-03-01 13:46 Matthias Damm Status new => feedback
2021-03-01 13:46 Matthias Damm Note Added: 0013837
2022-09-06 17:07 Jim Luth Status feedback => resolved
2022-09-06 17:07 Jim Luth Resolution open => won't fix
2022-09-06 17:07 Jim Luth Note Added: 0017528
2022-09-07 13:30 BjarneBostrom Status resolved => feedback
2022-09-07 13:30 BjarneBostrom Resolution won't fix => reopened
2022-09-07 13:30 BjarneBostrom Note Added: 0017538
2023-03-20 05:13 Matthias Damm Status feedback => resolved
2023-03-20 05:13 Matthias Damm Resolution reopened => no change required
2023-03-20 05:13 Matthias Damm Note Added: 0018904
2023-03-28 15:27 Jim Luth Note Edited: 0018904
2023-03-28 15:29 Jim Luth Status resolved => closed
2023-03-28 15:29 Jim Luth Note Added: 0019044