C# is a popular programming environment that is used for Server and Client development.
After installing the NET 8.0 SDK, the sample can be built with following command:
dotnet build .\UaRestClient.sln
After building, the sample can be run with following command:
dotnet .\Client\bin\Debug\net8.0\UaRestClient.dll
Visual Studio Code can be used to edit and debug the sample.
The client uses stubs autogenerated with the OpenAPI Generator. The stubs for .NET are published in the GitHub respository. The GitHub stubs have been fixed up to remove obsolete code and incorporate the NodeId and BrowseName constants. The repository is a submodule and built when the sample application is built.
The Server defines a custom Information Model described by a NodeSet.
A client that wishes to use these custom information models needs definitions for NodeIds and BrowseNames defined by the model. The UA ModelCompiler takes a NodeSet as input and produces the constant declarations in different programming languages.
The Python declarations for the Measurements information model have been prebuilt here. Instructions on building the constants can be found here.
A client that needs to consume structure defined in a custom information model needs to generate classes from the NodeSet. The OpenAPI Generator a widely used tool that normally is used to generate code for REST APIs, however, the classes can be reused for other purposes. For that reason UA ModelCompiler also generates an OpenAPI definition from the NodeSet.
The script creates a C# project that the sample can link to.