Can anyone explain in a bit more clear way the differences between Service, Method, and Program in OPC UA? Also where to find sample implementation of them? I am aware of the Git source I am asking a bit more specific address than just the entire source code.
callable software function that is a component of an Object
executable Object that, when invoked, immediately returns a response to indicate that execution has started, and then returns intermediate and final results through Subscriptions identified by the Client during invocation
Client-callable operation in a Server
Note 1 to entry: Services are defined in OPC 10000-4. A Service is similar to a method call in a programming language or an operation in a Web services WSDL contract.
Hi Randy, thanks for your reply, however, I could read this in the specification as well 😉
I asked these questions here with the hope that I will get a bit more explanation on them by an example. Maybe it is very obvious for you but for someone who just started utilizing the OPC UA specification is a bit confusing. Would it be possible to shed a bit more light with an example for each of them and explain where to use what?
Okay now it is a bit more clear, now the question is how to wire a Client to Service, Method, or Program? There must be somehow a mechanism to allow a Client to call a Method in an OPC UA object, the same goes for Service and Program as well.
Let me tell you my understanding with an example so you can correct me if I misunderstood somewhere:
Scenario: I need to let my Client invoke a method on the server-side when the temperature exceeds the setpoint.
- I use a DataSetMetaData to define the structure of my DataSet that will represent a Node (temperature) OPC UA Publisher Address Space
- My defined DataSet will have a timestamp and a float variable to store temperature
- When the value of temperature changed the Publisher will notify the Subscriber and the Subscriber needs to compare the new value with SetPoint and if it is higher than the SetPoint will need to invoke a method that is in the DataSet which is representing the temperature node in the address space.
Now the question is how to define the method in the DataSet and how to wire it to the Client? The next question would be what if the Client wants to trigger a program to be executed? How this C# Class will be executed?
DataSets and DataSetMetaData are features of PubSub.
PubSub only supports data and event monitoring.
Methods require that the Call service be invoked via Client-Server.
If your client cannot connect using Client-Server you will need to set of reciprocate subscriptions.
i.e. the Publisher subscribes to DataSet. When it receives an update it executes a command based on the contents of the message.
The command would be described by a DataSetMetaData provided by the Subscriber.
What I couldn`t understand is this part "If your client cannot connect using Client-Server you will need to set of reciprocate subscriptions." what reciprocate subscriptions means? How to set it of?
Okay, if invoking Methods requires Client-Server communication model, how about Programs? Does Programs also requires Client-Server communication model or can be done in PubSub as well?
Sorry for the English errors.
If your client cannot connect using Client-Server you will need to set of reciprocal subscriptions.
i.e. both sides are Publishers and Subscribers.
Programs defines an information model which is only visible with Client-Server, however, a Program produces events for state changes which can be published.
The methods used to trigger state changes in a Program require Client Server, however, you could devise a mechanism specific to your application that maps a Method call only to a DataSet.
1. It just means 2 applications which are both publisher and subscriber and are configured to send messages to each other.
2. No. The Program model has Variables and produces Events. You can have a DataSet that reports values of the Variables or the Events. What you can't do is browse the Program model or call Methods directly. Those features require Client-Server.