Searching a Directory

The following code example retrieves the first 500 objects in the fabrikam.com LDAP directory and their associated names, descriptions, and creation date attribute values.

<se:Envelope xmlns:se="https://schemas.xmlsoap.org/soap/envelope/">
   <se:Body xmlns="urn:oasis:names:tc:DSML:2:0:core">
      <batchRequest>
         <searchRequest dn="dc=fabrikam,dc=com" scope="wholeSubtree" derefAliases="neverDerefAliases" sizeLimit="500">
            <filter>
               <present name="objectclass"/>
            </filter>
            <attributes>
               <attribute name="name"/>
               <attribute name="description"/>
               <attribute name="whenCreated"/>
            </attributes>
         </searchRequest>
      </batchRequest>
   </se:Body>
</se:Envelope>

The se:Envelope and se:Body SOAP elements enclose the DSML payload. The first element of the DSML payload, batchRequest, is the mandatory top-level element for all DSML V2 requests. The searchRequest element retrieves the directory objects and the attribute elements specify which directory attribute values to return with each associated directory object.

For more information, see Transmitting and Receiving SOAP-DSML Messages.