Register open62541 server to Local Discovery Server (LDS)

496 views
Skip to first unread message

adriana...@gmail.com

unread,
Jun 4, 2018, 1:11:23 PM6/4/18
to open62541
I am trying to register my open62541 server to the Local Discovery Server running on the same machine. However, I get the following error:

[2018-06-04 13:00:37.720 (UTC-0400)] error/client       Connecting to the discovery server failed with statuscode BadSecureChannelIdInvalid
[2018-06-04 13:00:37.720 (UTC-0400)] error/server       Could not register server with discovery server. Is the discovery server started? StatusCode BadSecureChannelIdInvalid

I have another server (written using UnifiedAutomation) that's able to connect to the LDS, so I know it is running. Here is the code I use to initialize and start my server:

    /* Load certificate and private key */
    UA_ByteString certificate = loadFile("server_cert.der");
    UA_ByteString privateKey = loadFile("server_key.der");

    /* Load the trustlist */
    UA_ByteString *trustList = (UA_ByteString *) UA_Array_new(1, &UA_TYPES[UA_TYPES_BYTESTRING]);
    size_t trustListSize = 1;
    UA_ByteString_copy(&certificate, &trustList[0]);

    /* Loading of a revocation list currently unsupported */
    UA_ByteString *revocationList = NULL;
    size_t revocationListSize = 0;

    UA_ServerConfig *config = UA_ServerConfig_new_basic128rsa15(4841, &certificate, &privateKey,
                                                                trustList, trustListSize,
                                                                revocationList, revocationListSize);

    UA_Server *server = UA_Server_new(config);

    /* Try to register server to LDS */
    UA_StatusCode retval =
            UA_Server_addPeriodicServerRegisterCallback(server,
                                                        "opc.tcp://localhost:4840",
                                                        10 * 60 * 1000,
                                                        500,
                                                        NULL);

    /* Run the server */
    retval = UA_Server_run(server, &running);
    return (int)retval;

The certificate and private key were generated using the create_self-signed.py script located in /tools/certs, and I copied those two files into my project files. I use UaExpert to try to connect to my server, but I get the message "Connecting failed with error 'BadSecurityChecksFailed'" when I choose an endpoint higher than None. 

How can I enable my server to connect to the LDS? Thanks.

Stefan Profanter

unread,
Jun 6, 2018, 3:36:46 AM6/6/18
to open62541
Hi Adriana,
can you create a new issue for this on github, so that we can keep track of it?

Please indicate there which LDS you are using, which version of open62541 and all the necessary steps to reproduce it.

One short remark:
It could be that your LDS requires some specific client settings. It is only supported in current master branch to use your own client for the register call:
See:

BR
Stefan
Reply all
Reply to author
Forward
0 new messages