Hi Roberto,
I tried to understand your problem by using the SampleUaConsole. I too faced some problems, and I was able to solve the problem and was able to connect to the server with security. I will mention the steps which solved the problem. I hope that will solve the problem for you as well.
+ SampleUaConsole.exe will look for the servers in the local machine. So we have to change the code in UaClient.cpp file.
+ open the project
SampleUAConsole.sln inside folder
<path_where_MatrikonOpc_SDK_is_installed>/MatrikonOPC/UA_SDK/Samples/Sample_Client_SourceCode/+ change the server url path in the function
bool UaClient::DiscoverServer()ex:
ldsUrl = L"opc.tcp://";
ldsUrl += L"199.63.214.53"; //IP address of the server
ldsUrl += L":4840"; //port number of the server
+ rebuild the solution, and run newly generated SampleUAConsole.exe file inside the Debug folder.
+ Now you should be able to connect to server with out security.
+ But, With security there it will fail first time.
+ Copy the client certificate from the rejected folder to outside the rejected folder in the machine where server is running. just like our previous conversation. copy from
../../Debug/pki/applications/trust/certs/rejected to
../../Debug/pki/applications/trust/certs+ Now client will be able to connect to server with certificate. But it will fail to browse nodes.
+ to fix the browsing nodes problem, UaClient.cpp code has to be modified again.
+ Reason for failing to browse for nodes in server is, the URI in the client certificate, is not matching with the
uaSessionConfig->ClientApplicationDescription().ApplicationUri() and
uaSessionConfig->ClientApplicationDescription().ProductUri(). It can be verified by opening the client certificate, and check the
Subject alternate name under details tab of the client certificate and
uaSessionConfig->ClientApplicationDescription().ApplicationUri() and
uaSessionConfig->ClientApplicationDescription().ProductUri() in uaClient.cpp file
+ Now copy the URL value present inside the Subject alternate name, and replace the string
L"http://HoneywellOpc.com/UA Client Toolkit"; in UaClient.cpp.
+ build the UaClient.cpp and run the newly generated SampleUAConsole.exe file inside the Debug folder.
+ Now client will be able to connect to server and browse nodes with security.
Basically, URL value in
Subject Alternate Name of the client certificate should match with the
uaSessionConfig->ClientApplicationDescription().ApplicationUri() and
uaSessionConfig->ClientApplicationDescription().ProductUri(). I hope this helped you to solve the problem.
Regards,
Basavaraju B V
Edited by user Wednesday, July 8, 2015 12:26:31 AM(UTC)
| Reason: Not specified