We wrote an OPC UA Server using Unified Automation .NET Server SDK version 2.5.2 (.NET Framework 4.6.1) and ran into a connection problem when using MatrikonOPC UA Proxy, which works similar to UaGateway, to connect an OPC DA client to the OPC UA server.
The problem was that the DA client would connect and immediately disconnect from the server regardless of the security policy or connection token. Working with Matrikon support, we were able to successfully connect by disabling endpoint description check in MatrikonOPC UA Proxy. According to Matrikon development team, the problem is that the OPC UA Server returns different endpoints for the discovery service and the session.
Here is exactly what they said:
We used the GettingStarted_VS2015 Client project that case with the SDK and compared"Here proxy has saved the endpoints returned by GetEndpoints(discovery service) call and comparing with CreateSession response’s “serverEndpoints []”. UA Proxy is finding difference here. Customer can write simple UA client to call GetEndPoint and CreateSession. Compare the ServerEndPoints returned."
Code: Select all
endpoints = discovery.GetEndpoints(ServerUrlTB.Text);
Code: Select all
m_session.Connect(SelectedEndpoint, m_session.DefaultRequestSettings);
Code: Select all
SelectedEndpoint.EndpointUrl = Uri.EscapeUriString(SelectedEndpoint.EndpointUrl);
The only possible issue we could find was with NamespaceUris which do not match any of the endpoints. In the BasicClient_VS2015 example, this causes an exception when checking for matching NamespaceUri in the MainForm.cs during a connection.
Code: Select all
for (i = 0; i < m_session.NamespaceUris.Count; i++)
{
if (m_session.NamespaceUris[i] == txtNamespaceUri.Text)
{
m_NameSpaceIndex = i;
}
}
// Check if the namespace was found
if (m_NameSpaceIndex == 0)
{
throw new Exception("Namespace " + txtNamespaceUri.Text + " not found in server namespace table");
}
What are NamespaceUris used for?
Are you aware of any issues with using MatrikonOPC UA Proxy and UnifiedAutomation OPC UA Server?
Does UaGateway check for differences between discovery.GetEndpoints() and session.Connect() endpoints?
We should note that the same problem occurs when using MatrikonOPC UA Proxy with UaDemoServer_VS2015.
Also, our OPC UA Server works fine with UaGateway, UaExpert, and Kepware KEPServerEX 5. The reason we are testing MatrikonOPC UA Proxy is because some of our customers want to use it.
Sincerely,
Jonathan