Register Server at LDS

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

Moderator: uasdkc

Post Reply
fpethig
Hero Member
Hero Member
Posts: 37
Joined: 30 Sep 2013, 08:19

Register Server at LDS

Post by fpethig »

Hello,

since I couldn't find any documentation about this I ask myself if it is possible to register a OPC UA Server based on the ANSI-C SDK at a LDS running on another machine? Could you point me to the right direction here? Is there any documentation on this?

Regards
Florian

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Register Server at LDS

Post by Support Team »

Hello Florian,

you can set the

Code: Select all

_UaServer_Configuration Struct Reference
accordingly (see doc: http://documentation.unified-automation ... ation.html).

Code: Select all

   /** Configures the server to register at a discovery server in regular intervals. */
   #define UASERVER_DISCOVERY_REGISTER     OPCUA_CONFIG_YES
   /** The URL of the discovery server. */
   #define UASERVER_DISCOVERY_URL          "opc.tcp://localhost:4840/UADiscovery/discovery"
   /** The registration interval in milliseconds. */
   #define UASERVER_DISCOVERY_INTERVAL     300000

    UaServer_Configuration      *pServerConfiguration = UaServer_GetConfiguration( &g_UaServer );
    /* configure server to register at discovery server */
    pServerConfiguration->bRegisterAtDiscoveryServer = OpcUa_True;
    OpcUa_String_AttachReadOnly( &pServerConfiguration->sDiscoveryServerUrl, UASERVER_DISCOVERY_URL );
    pServerConfiguration->uDiscoveryRegistrationInterval = UASERVER_DISCOVERY_INTERVAL;
Best regards
Support Team

fpethig
Hero Member
Hero Member
Posts: 37
Joined: 30 Sep 2013, 08:19

Re: Register Server at LDS

Post by fpethig »

Hello SupportTeam,
thank you!

Nevertheless now I get the following output:

|0x0| 14:42:20.337Z UaServer_Discovery: Connect to local discovery server with security failed, please check security configuration (ret=0x80ae0000)

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Register Server at LDS

Post by Support Team »

That's because the servers don't know the security certificate from each other. To accept the LDS' certificate, copy the certificate from the rejected folder to the certs folder. Also the LDS has to accept your servers certificate.

Best regards
Support Team

fpethig
Hero Member
Hero Member
Posts: 37
Joined: 30 Sep 2013, 08:19

Re: Register Server at LDS

Post by fpethig »

We did this. But it still won't work.

Could this be about the issue with Hostnames and IP-Addresses? Could we just somewhere configure to put IP-Addresses in the certificate?

Thanks for your help.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Register Server at LDS

Post by Support Team »

Have you checked the log file of your LDS?

Best regards
Support Team

fpethig
Hero Member
Hero Member
Posts: 37
Joined: 30 Sep 2013, 08:19

Re: Register Server at LDS

Post by fpethig »

We finally solved the issue about certificates and the ANSIC OPCUA Server is registered successfully at our LDS. But it seems to register with URL "opc.tcp://localhost:1243" instead of "opc.tcp://<correct_ipaddress>:1243". Is there some type of configuration we also have to adapt?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Register Server at LDS

Post by Support Team »

Hello,

for the own server URL is used what was set with UaServer_Initialize() as a_sEndpointUrl.

Best regards
Support Team

fpethig
Hero Member
Hero Member
Posts: 37
Joined: 30 Sep 2013, 08:19

Re: Register Server at LDS

Post by fpethig »

In Servermain():

/* Create EndpointURL and ApplicationURI strings */
GetFQHostname(szHostname, sizeof(szHostname));
OpcUa_SnPrintfA(szEndpointURL, sizeof(szEndpointURL)-1, "opc.tcp://%s:%u", szHostname, UASERVER_PORT);
OpcUa_SnPrintfA(szApplicationUri, sizeof(szApplicationUri)-1, "urn:%s:%s", szHostname, UASERVER_APPLICATIONURI);

szEndpointURL is set to "opc.tcp://<correcthostname>:1234" not the localhost.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Register Server at LDS

Post by Support Team »

Hello,

Which LDS (vendor, version) are you using exactly? Older LDSs of the OPC Foundation had the problem that they replaced the hostname in the response, although the server registered correctly.
Maybe you can check the log files of the LDS?

When the hostname was set correctly with UaServer_Initialize() , there should be no problem.

Best regards
Support Team

Post Reply