Quick update...
I solved it: it was enough to use the IP address of the LDAPS server instead of the NS.
I don't know why, but even if Ubuntu was able to resolve the domain name of the LDAPS server, the same thing didn't happen using the NS in the netXMS parameters.