This service takes a query and tries to find someone in the directory who you might be looking for.
The result is returned as DSML.


Use this form to try out some queries:

Search and return results as DSML


A valid query looks like this:

http://webapp.middleware.iad.vt.edu/peoplesearch/PeopleSearch?query=dfisher
or
http://webapp.middleware.iad.vt.edu/peoplesearch/PeopleSearch?query=Daniel+Fisher
If you only want to receive certain attributes you should do this:
http://webapp.middleware.iad.vt.edu/peoplesearch/PeopleSearch?query=dfisher&attrs=givenname&attrs=surname
The default content-type returned is text/xml, if you want text/plain you should do this:
http://webapp.middleware.iad.vt.edu/peoplesearch/PeopleSearch?query=dfisher&content-type=text
The default result set is in DSML version 1 format.
If you want DSML version 2 you should do this:
http://webapp.middleware.iad.vt.edu/peoplesearch/PeopleSearch?query=dfisher&dsml-version=2


Here is some sample java code for accessing this resource:

import java.util.ArrayList;
import java.net.URL;
import java.net.URLEncoder;
import org.dom4j.Document;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;

public class PeopleSearch {
  public static void main(String[] args) throws Exception {

    try {

      String query = null;
      ArrayList attrsArrayList = new ArrayList();

      for (int i = 0; i < args.length; i++) {
        if (args[i].equals("-h")) {
          throw new ArrayIndexOutOfBoundsException();
        } else if (args[i].equals("-q")) {
          query = args[++i];
        } else if (args[i].equals("-a")) {
          attrsArrayList.add(args[++i]);
        } else {
          attrsArrayList.add(args[i]);
        }
      }

      String[] attrs = attrsArrayList.toArray(new String[0]);

      StringBuffer url = new StringBuffer("http://webapp.middleware.iad.vt.edu/peoplesearch/PeopleSearch");
      if (query != null) {
        url.append("?query=").append(URLEncoder.encode(query, "UTF-8"));
        if (attrs != null) {
          for (int i = 0; i < attrs.length; i++) {
            url.append("&attrs=").append(URLEncoder.encode(attrs[i], "UTF-8"));
          }
        }
      }

      Document doc = new SAXReader().read(new URL(url.toString()));
      XMLWriter writer = new XMLWriter(System.out,
                                       OutputFormat.createPrettyPrint());
      writer.write(doc);

    } catch (ArrayIndexOutOfBoundsException e) {
      System.out.println("Usage: PeopleSearch ");
      System.out.println("where <options> includes:");
      System.out.println("  -q query");
      System.out.println("  -a <attributes>");
      System.out.println("where <attributes> is:");
      System.out.println("  a space delimited list of return attributes");
      System.exit(1);

    }
  }
}


In addition to the fuzzy logic provided by the PeopleSearch servlet, there is also a servlet which provides direct access to the LDAP. More information is available here.