xBus

XML documents to access LDAP servers

The request and response files of the automated tests are a good reference for the XML documents used for retrieving directory information from LDAP servers.

 Request

Two ways of getting information are supported:

  • Search for attributes: All entries found directly under the given context containing the given attributes will be returned.
  • Search for strings: All entries found under the subtree of the given context satisfying the given search string (as specified in RFC 2254) will be returned.
The context is optional. If it's not specified in the search, the Base DN of the LDAPConnection is used.

01 <?xml version="1.0" encoding="UTF-8"?>
02 <LDAP_Input_Example>
03     <SearchAttributes context="ou=xBus_Development">
04         <sn>Doe</sn>
05         <title>Developer</title>
06     </SearchAttributes>
07     <SearchAttributes />
08     <SearchString context="ou=xBus_Development">objectClass=top</SearchString>
09     <SearchString>cn=Stefan Fleckenstein</SearchString>
10 </LDAP_Input_Example>

02:
The name of the root element is an arbitrary string, which will not be evaluated.
03 - 06:
The first example searches for entries with sn=Doe and title=Developer directly under the context ou=xBus_Development.
07:
The second example searches for all entries directly under the Base DN.
08:
Searching for all entries satisfying the filter objectClass=top recursivly under the context ou=xBus_Development is the purpose of the third example.
09:
At last all entries with cn=Stefan Fleckenstein are searched recursivly under the Base DN.
 Response

01 <?xml version="1.0" encoding="UTF-8"?>
02 <Test0013LDAP>
03     <Result searchattributes="{title=title: Developer, sn=sn: Doe}"
04             context="ou=xBus_Development">
05         <Record>
06             <objectClass>organizationalPerson</objectClass>
07             <objectClass>person</objectClass>
08             <objectClass>top</objectClass>
09             <sn>Doe</sn>
10             <title>Developer</title>
11             <cn>John Doe</cn>
12         </Record>
13     </Result>
14     <Result searchattributes="No attributes" context="">
15         <Record>
16             <ou>xBus_Development</ou>
17             <objectClass>organizationalUnit</objectClass>
18             <objectClass>top</objectClass>
19         </Record>
20     </Result>
21     <Result searchstring="objectClass=top" context="ou=xBus_Development">
22         <Record>
23             <ou>xBus_Development</ou>
24             <objectClass>organizationalUnit</objectClass>
25             <objectClass>top</objectClass>
26         </Record>
27         <Record>
28             <telephoneNumber>+49 89 4207980</telephoneNumber>
29             <objectClass>top</objectClass>
30             <objectClass>organizationalPerson</objectClass>
31             <sn>Fleckenstein</sn>
32             <title>Project Leader</title>
33             <cn>Stefan Fleckenstein</cn>
34         </Record>
35         <Record>
36             <objectClass>organizationalPerson</objectClass>
37             <objectClass>person</objectClass>
38             <objectClass>top</objectClass>
39             <sn>Doe</sn>
40             <title>Developer</title>
41             <cn>John Doe</cn>
42         </Record>
43     </Result>
44     <Result searchstring="cn=Stefan Fleckenstein" context="">
45         <Record>
46             <telephoneNumber>+49 89 42079830</telephoneNumber>
47             <objectClass>top</objectClass>
48             <objectClass>organizationalPerson</objectClass>
49             <sn>Fleckenstein</sn>
50             <title>Project Leader</title>
51             <cn>Stefan Fleckenstein</cn>
52         </Record>
53     </Result>
54 </Test0013LDAP>

02:
The name of the root element is the name of the interface as defined in the configuration.
03 - 13, 14 - 20, 21 -43, 44 - 53:
For every search statement in the request there is a result. The Result tag contains attributes with the searchstring or searchattributes and the context of the search statement. Every found entry is returned as a Record, containing all attributes of the entry as subelements.
 LDIF of example content

The LDAP server has been filled with the following content, to deliver the results for this example (LDIF format):

version: 1
dn:
objectClass: top
objectClass: organization
o: xBus
telephoneNumber: +49 89 4207980

dn: ou=xBus_Development,
objectClass: organizationalUnit
objectClass: top
ou: xBus_Development

dn: cn=Stefan Fleckenstein,ou=xBus_Development,
objectClass: top
objectClass: organizationalPerson
cn: Stefan Fleckenstein
sn: Fleckenstein
telephoneNumber: +49 89 4207980
title: Project Leader

dn: cn=John Doe,ou=xBus_Development,
objectClass: organizationalPerson
objectClass: person
objectClass: top
cn: John Doe
sn: Doe
title: Developer