| < Day Day Up > |
|
One interesting means of exchanging directory information is the DSML standard. The directory services markup language DSML is a dialect of extended markup language (XML). DSML takes advantage of the XML syntax, enabling applications to share data using a simple human-readable format.
A thorough explanation of XML is beyond the scope of this book. For our purposes, it is enough to say that XML is a standard of representing Web content in ASCII format. As opposed to HTML, it allows the user to define her own tags and thus extend the language. As such, XML can be put on any Web server and transferred like any other Web document.
DSML was created initially by Bowstreet Inc. in July 1999. It is intended as an open standard and is maintained on the Web site of OASIS http://www.oasis-open.org/committees/dsml. OASIS is sponsored by Netscape, Sun Microsystems, Oracle, Novell, Microsoft, IBM, and other enterprises. At the time of this writing, DSML is in version 2. DSML (v1) provides a means of representing directory content in XML. DSML (v2) extends the functionality to allow a client to formulate queries, delete, insert, and modify actions as XML documents. Perhaps obviously, the results of these operations are sent back in XML format.
The big advantage of DSML is that it is an ASCII format markup language and therefore the directory content can be made available via a Web server. This means that you can distribute directory content across enterprise boundaries, for example in your extranet, or even make it available to customers over the Internet. Since it is ASCII, you can export your directory content in DSML and import it into a completely different repository, for example a directory server from a different supplier. This means that even a client unable to speak LDAP can access a directory. This could, for example, be an application developed using XML tools and then be integrated in a directory-driven environment.
At this point, a few examples are very helpful to get a basic understanding of how all this works. These examples are drawn from the DSML draft available from OASIS. First, Exhibit 20 shows you how to formulate a search using DSML. As you may notice, the request is included in the <searchRequest> and </searchRequest> tags. Meanwhile, the filter is defined in <filter> and </filter> tags. Exhibit 21 instead shows the result. As you can imagine, using a style sheet you can easily format this XML code into a pretty good-looking HTML page.
<searchRequest dn="ou=Marketing,dc=Microsoft,dc=com" scope="singleLevel" derefAliases="neverDerefAliases" sizeLimit="1000"> <filter> <substrings name="sn"><final>john</final></substrings> </filter> </searchRequest>
<searchResponse> <searchResultEntry dn="OU=Development,DC=Example,DC=COM"> <attr name="allowedAttributeEffective"> <value>description</value> <value>ntSecurityDescriptor</value> <value>wwwHomepage</value> </attr> </searchResultEntry> <searchResultEntry dn="CN=David,OU=HR,DC=Example,DC=COM"> <attr name="objectclass"><value>person</value></attr> <attr name="sn"><value>Johnson</value></attr> <attr name="givenName"><value>David</value></attr> <attr name="title"><value>Program Manager</value></attr> </searchResultEntry> <searchResultEntry dn="CN=JSmith, OU=Finance,DC=Exam- ple,DC=COM"> <attr name="objectclass"><value>top</value></attr> <attr name="objectclass"><value>person</value></attr> <attr name="objectclass"><value>organizationalPer- son</value></attr> <attr name="sn"><value>Smith</value></attr> </searchResultEntry> <searchResultDone> <control type="1.2.840.113556.1.4.621" criticality="false"> <controlValue xsi:type="xsd:base64Binary"> U2VhcmNoIFJlcXVlc3QgRXhhbXBsZQ== </controlValue> </control> <resultCode code="0"/> </searchResultDone> </searchResponse>
Finally, Exhibit 22 and Exhibit 23 show an example of adding an entry to a directory. Exhibit 22 shows the request the client has to produce, and Exhibit 23 the response the client gets. Exhibits 20 and 21 and Exhibits 22 and 23 are taken from the DSML draft document.
<addRequest dn="CN=Alice,OU=HR,DC=Example,DC=COM"> <attr name="objectclass"><value>top</value></attr> <attr name="objectclass"><value>person</value></attr> <attr name="objectclass"><value>organizationalPerson</value></attr> <attr name="sn"><value>Johnson</value></attr> <attr name="givenName"><value>Alice</value></attr> <attr name="title"><value>Software Design Engineer</value></attr> </addRequest>
<addResponse> <resultCode code="0"/> <errorMessage>completed</errorMessage> </addResponse>
There is a handy tool set written in Java that helps to export directory content to DSML and import it into an LDAP database. The tools are named LDAPtoDSML and DSMLtoLDAP. The software has been developed by Gervase Markham and is available at http://www.dsml-tools.org.
These tools make it easy to export and reimport LDAP data. The following line exports data from our LDAP repository:
LDAPtoDSML
To import data into an LDAP repository, use the following line:
DSMLtoLDAP
As we close the DSML section, we should briefly mention the Castor framework, which provides data binding. Castor is developed by Exolab, an organization working in the development of open-source software based on Java and XML.
Data binding facilitates the transfer of one data model into another. For example, Castor can map an XML data model into Java classes by generating Java classes from an XML document. It can also use instances of these classes to store data in XML form. Castor is also capable of binding data from Java classes to tables, rows, and columns of a RDBMS. One of the functionalities being investigated at the time of this writing is the development of mapping from LDAP to Java and finally to XML.
Castor DSML remains (at the time of this writing) a work in progress. You can learn more about the Castor project at the Castor home page: http://castor.exolab.org.
| < Day Day Up > |
|