An application can populate a request model itself, and then have
data returned by the request mapped into a toolkit context. To use the LDAP
Access Service with externalized output data, do the following:
- Obtain a request model.
- Populate the request model with data.
- Obtain a context into which the response data will be mapped.
- Obtain a format to use in mapping the data.
- Initialize the service.
- Carry out the request
The code is as follows:
LDAPLookupRequest request=new LDAPLookupRequest();
request.setName("cn=John Doe,ou=Finance,o=XYZ Corp,c=US");
Context context=(Context) ContextFactory.createContext("lookupContext");
LDAPResponseFormat format=(LDAPResponseFormat) FormatElement.readObject("lookupResFmt");
service.initialize();
service.performRequest(request, context, format);