Create local discovery server for integration testing purposes

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
trumpf_jj
Jr. Member
Jr. Member
Posts: 2
Joined: 15 Nov 2023, 11:24

Create local discovery server for integration testing purposes

Post by trumpf_jj »

Dear fellow OPC developers,

I want to test my OPC-UA-Client with a OPC-UA-Server. Therefore I want to create both, the server and the client locally, and let them communicate. Unfortunetly the implementation of our client requires the server to be behind a discovery server.

Explanation:
I created an ApplicationInstanceBase instance and loaded the default configuration. When I call the Start-Method I pass the server manager to it (this - I start the application from inside the server manager).

Code: Select all

public void Start()
{
    // Create settings object and load default settings
    mAppInstanceBase = new ApplicationInstanceBase();
    mAppInstanceBase.LoadConfiguration(false, true);

    // Load license from executing assembly (the file is embedded in this project)
    ApplicationLicenseManager.AddProcessLicenses(Assembly.GetExecutingAssembly(), "License.lic");

    mAppInstanceBase.Start(this, null, this);
}
The server is accessible via UaExpert and the nodes are displayed. Unfortunetly my client-side is unable to connect:

Code: Select all

using (var tmpDiscovery = new Discovery())
{
	var server = tmpDiscovery.FindServers(mUrl);
}
because it throws a
System.MissingMethodException
with the Message
Method not found: 'UnifiedAutomation.UaBase.DiscoveryClient UnifiedAutomation.UaBase.DiscoveryClient.Create(UnifiedAutomation.UaBase.ApplicationInstanceBase, UnifiedAutomation.UaBase.EndpointConfiguration, System.Uri, System.String, UnifiedAutomation.UaBase.ApplicationThreadPool)'.
I'm confused since my server has the DiscoveryServerUrl-Property set (opc.tcp//localhost:4840) but the client is unable to connect...

I'd appreciate any type of hint or tips in general.

Thanks in advance,
Julian

trumpf_jj
Jr. Member
Jr. Member
Posts: 2
Joined: 15 Nov 2023, 11:24

Re: Create local discovery server for integration testing purposes

Post by trumpf_jj »

I found the cause of the exception. We used the UaClient-NuGet-Package with version 3.0.1 and the Server used the most current version (3.3.1).

Therefore the client probably tried to use removed methods.

I updated the client to 3.3.1 as well and everything is running fine!

This issue can therefore be closed.

Best regards,
Julian

Post Reply