WebLdapConnect Function

Action

Establishes a connection for LDAP transactions with a specified host.

Include file

WebAPI.bdh

Syntax

WebLdapConnect( inout hLDAP : number, 
                in    sHost : string, 
                in    nPort : number, 
                in    nFlag : number optional ): boolean;

Return value

  • true if the connection attempt was completed successfully

  • false otherwise

Parameter Description
hLDAP

Variable receiving a handle to the Web connection

If this parameter contains a handle to a Web connection prior to the WebLdapConnect function call, the memory allocated with the handle is released. Whenever you want to create a new Web connection, make sure this variable is initialized with 0 (this is automatically done within transactions when they are executed for the first time, but not within functions)

sHost Domain name or IP address of the LDAP server, for example, hostname.com or 192.231.34.1
nPort Port to connect to, usually WEB_PORT_LDAP (389)
nFlag

Flag specifiying the LDAP version (optional):

  • WEB_LDAP_FLAG_VERSION1

  • WEB_LDAP_FLAG_VERSION2

  • WEB_LDAP_FLAG_VERSION3

Besides, this flag specifies additional configuration of secure queries. Possible values are:

  • WEB_LDAP_FLAG_SSL

This value has to be set to 0 for insecure transactions (default).

Example

dcltrans 
  transaction TWebLdap 
  var
     hLdap: number; 
  begin 
    WebLdapConnect(hLdap, "standardhost", WEB_PORT_LDAP);
     WebLdapDisconnect(hLdap); 
  end TWebLdap;

SilkEssential sample

LDAP.sep