Runtime components : Service components : LDAP Access Service : Reference : LDAP request definition examples
  
LDAP request definition examples
Definitions for each of the LDAP requests are split between the toolkit data definition file and the toolkit formats definition file.
Example data:
Given the following general data definitions in the data definition file:
<field id="firstName"/>
<field id="lastName"/>
<field id="middleInitial"/>
<field id="fullName"/>
<field id="salutation"/>
<field id="street"/>
<field id="city"/>
<field id="country"/>
<field id="department"/>
<field id="organization"/>
<field id="userName"/>
<field id="password"/>
Following is a breakdown of the structure of the definitions for each request type.
LIST Request Example
<kColl id="listOpData">
<field id="bindName"/>
<field id="className"/>
</kColl>
<fmtDef id="listOpReqFmt">
<ldapRequest requestType="list">
<map id="dynamicName source="listOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
</ldapRequest>
</fmtDef>
<fmtDef id="listOpResFmt">
<ldapResponse responseType="list">
<map source="ldapOutCtx" target="listOpCtx">
<mapping source="listResults.0.name"
target="bindName"/>
<mapping source="listResults.0.classname"
target="className"/>
</map>
</ldapResponse>
</fmtDef>
LISTBINDINGS Request Example
<kColl id="listBindingsOpData">
<field id="bindName"/>
<field id="className"/>
<field id="object"/>
</kColl>
<fmtDef id="listBindingsOpReqFmt">
<ldapRequest requestType="listbindings">
<map id="dynamicName" source="listBindingsOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
</ldapRequest>
</fmtDef>
<fmtDef id="listBindingsOpResFmt">
<ldapResponse responseType="listbindings">
<map source="ldapOutCtx" target="listBindingsOpCtx">
<mapping source="listBindingsResults.0.name"
target="bindName"/>
<mapping source="listBindingsResults.0.classname"
target="className"/>
<mapping source="listBindingsResults.0.object"
target="object"/>
</map>
<ldapResponse>
</fmtDef>
LOOKUP Request Example
<kColl id="lookupOpData">
<field id="object"/>
<refData refId="fullName"/>
<refData refId="firstName"/>
<refData refId="lastName"/>
<refData refId="organization"/>
</kColl>
<fmtDef id="lookupOpReqFmt">
<ldapRequest requestType="lookup">
<map id="dynamicName" source="lookupOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="fullName" target="cn"/>
<mapping source="organization" target="ou"/>
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
</ldapRequest>
</fmtDef>
<fmtDef id="lookupOpResFmt">
<ldapResponse responseType="lookup">
<map source="ldapOutCtx" target="lookupOpCtx"
sourcePrefix="lookupResults">
<mapping source="object" target="object"/>
</map>
</ldapResponse>
</fmtDef>
SEARCH Request Example
<kColl id="searchOpData">
<field id="objType" value="organizationalPerson"/>
<refData refId="fullName"/>
<refData refId="firstName"/>
<refData refId="lastName"/>
<refData refID="userName"/>
<field id="bindName"/>
<field id="className"/>
<field id="object"/>
<field id="organization"/>
<kColl id="attributeFilterList" dynamic="true">
<field id="cn"/>
<field id="sn"/>
<field id="postalAddress"/>
<field id="ou"/>
<field id="c"/>
</kColl>
<field id="filterExpression"
value="(&(objectclass={0})(cn={1}))"/>
</kColl>
<fmtDef id="searchOpReqFmt">
<ldapRequest requestType="search" filterType="expression">
<map id="dynamicName" source="searchOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
<map id="filterList" source="searchOpCtx
target="ldapInCtx">
<mapping source="objType" target="filterList.0"
value="organizationalPerson"/>
<mapping source="fullName" target="filterList.1"/>
</map>
</ldapRequest>
</fmtDef>
<fmtDef id="searchOpResFmt">
<ldapResponse responseType="search">
<map source="ldapOutCtx" target="searchOpCtx">
<mapping source="searchResults.0.bindName"
target="bindName"/>
<mapping source="searchResults.0.className"
target="className"/>
<mapping source="searchResults.0.object"
target="object"/>
<mapping source="searchResults.0.ou"
target="organization"/>
<mapping source="searchResults.0.postalAddress"
target="address"/>
</map>
</ldapResponse>
</fmtDef>
CREATE Request Example
<kColl id="createOpData">
<refData refId="fullName"/>
<refData refId="firstName"/>
<refData refId="lastName"/>
<refData refID="organization"/>
<refData refId="street"/>
<refData refId="address"/>
<refData refId="password"/>
</kColl>
<fmtDef id="createOpReqFmt">
<ldapRequest requestType="create">
<map id="dynamicName" source="createOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="fullName" target="cn"/>
<mapping source="organization" target="ou"/>
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
<map id="attributes" source="createOpCtx"
target="ldapInCtx" targetPrefix="attributeList">
<mapping source="street" target="street"/>
<mapping source="address" target="postalAddress"/>
<mapping source="password" target="userPassword"/>
<mapping source="nil" target="objectclass" value="organizationalPerson"/>
</map>
</ldapRequest>
</fmtDef>
DESTROY Request Example
<kColl id="destroyOpData">
<refData refId="fullName"/>
<refData refId="firstName"/>
<refData refId="lastName"/>
<refData refID="organization"/>
</kColl>
<fmtDef id="destroyOpReqFmt">
<ldapRequest requestType="destroy">
<map id="dynamicName" source="destroyOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="fullName" target="cn"/>
<mapping source="organization" target="ou"/>
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
</ldapRequest>
</fmtDef>
MODIFY Request Example
<kColl id="modifyOpData">
<refData refId="fullName"/>
<refData refId="firstName"/>
<refData refId="lastName"/>
<refData refID="organization"/>
<refData refID="password"/>
</kColl>
<fmtDef id="modifyOpReqFmt">
<ldapRequest requestType="modify">
<map id="dynamicName" source="modifyOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="fullName" target="cn"/>
<mapping source="organization" target="ou"/>
<mapping source="nil" target="o" value="ibm"/>
<mapping source="nil" target="c" value="us"/>
</map>
<map id="modificationList" source="modifyOpCtx"
target="ldapInCtx" targetPrefix="modificationList"/>
<mod source="password" target="userPassword"
modcode="replace"/>
</map>
</ldapRequest>
</fmtDef>
GETATTRIBUTES Request Example
<kColl id="getAttributesOpData">
<refData refId="fullName"/>
<refData refId="firstName"/>
<refData refId="lastName"/>
<refData refId="organization"/>
<refData refId="password"/>
<kColl id="attributeFilterList" dynamic="true>
<field id="cn"/>
<field id="sn"/>
<field id="ou"/>
<field id="userPassword"/>
</kColl>
</kColl>
<fmtDef id="getAttributesOpReqFmt">
<ldapRequest requestType="getattributes">
<map id="dynamicName" source="getAttributesOpCtx"
target="ldapInCtx" targetPrefix="dynamicName">
<mapping source="fullName" target="cn"/>
<mapping source="organization" target="ou"/>
<mapping source="organization" target="ou"/>
<mapping source="nil" target="c" value="us"/>
</map>
</ldapRequest>
</fmtDef>
<fmtDef id="getAttributesOpResFmt">
<ldapResponse responseType="getattributes">
<map source="ldapOutCtx" target="getAttributesOpCtx"
sourcePrefix="getAttributeResults">
<mapping source="ou" target="organization"/>
<mapping source="userPassword" target="password"/>
</map>
</ldapResponse>
</fmtDef>
Go up to
Reference