|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV |
TODAY'S TOP SOA & WEBSERVICES LINKS Feature Directory Lookup with WML and SVG Clients
Directory Lookup with WML and SVG Clients
Dec. 21, 2000 12:00 AM
This article demonstrates how to leverage XML, LDAP, and Java technologies to create a Web-based directory lookup tool. This tool is built with a publicly available implementation of a Java/XML publishing framework called Cocoon (available at http://xml.apache.org/cocoon) and an LDAP server (we tested with the iPlanet Directory Server on Solaris). Using these off-the-shelf modules we can focus on the role of XML as a database-neutral format for data, and how it enables a flexible application architecture that lets you support both wireless and wireline clients. We'll demonstrate this with a WML client (WAP phone simulator on Windows) and an SVG client (Adobe's SVG plug-in for browsers on Windows). This article assumes the reader has a fairly good knowledge of XML and a working knowledge of XSL stylesheets. We'll first introduce WML (Wireless Markup Language) and SVG (Scalable Vector Graphics), then take a quick tour of LDAP and the Cocoon framework. Finally, we'll tie all the pieces together (the stylesheets, LDAP data source, XML "content" file) to form the application. Since we'll be using the Cocoon framework servlet, you won't need to write any Java code to try this demo.
What Is WML?
What Is SVG?
LDAP
Cocoon
Cocoon's page processing and caching showcases the feasibility of XML-based publishing for real-world applications. With Cocoon, application users can access XML documents that may also embed queries to data repositories. The query result set from the repository is converted into XML and inserted into the original XML document, which is then transformed into a format the client is capable of handling (WML or SVG in this example).
The Big Picture
Tomcat servlet engine can be configured to handle XML documents; that is, URLs can refer to XML documents with the .xml extension. If you follow the Cocoon install instructions, then Tomcat is configured to pass on all URL requests for XML documents to the Cocoon servlet. These steps (configuring the Tomcat servlet engine and the Cocoon framework to run under Tomcat) enable us to embed LDAP queries in XML documents using special XML tags that Cocoon supports. The Cocoon framework then fetches the LDAP query results, converts them to an XML document, and applies the appropriate XSL stylesheet. The dotted arrow in Figure 1 shows the relation between the stylesheets and the XML source document. The XML document can have XML Processing Instructions that actually refer to the stylesheet(s) for each output method (WML and SVG in our case).
The Details
Here's an example line of input for the Perl script:
SCHMOE| JOE| jschmoe| 3| joe. schmoe@ joeschmoecompany. com The comments in the Perl code explain how the LDIF entries are created. You may want to add more entries like the one above in order to play around with sample data that makes sense to you. The Perl script takes one command line argument - the text file (with the records in the above format) - and creates the LDIF file with the .ldif extension appended to the input file name. LDIF is where we do all the back-end work, so let's look at an example entry. LDIF entries contain mnemonic-named attributes and text values. The first attribute for each entry is the DN (distinguished name) attribute. This attribute should be unique for each entry in the LDAP server. The comma-separated parts that make up the DN are called relative distinguished names (RDNs). This is similar to file system path names. You compose the name of an LDAP entry by appending all the names of the parent entries back to the root. To continue this analogy: the basic LDAP model is also tree-structured just like a file system hierarchy. (This analogy breaks, however, in the manner in which DNs are composed: the least significant component is written first, with the more significant components written subsequently.) We'll make the most basic choice for our LDAP namespace and go with a simple scheme. Here's how the entry looks:
dn: uid= jschmoe, ou= people, o= joeschmoecompany. com An example of how Cocoon tags each directory search result is:
<searchresult ID=" uid= jschmoe, ou= people, o= demo"> Note: There's no DTD here and Cocoon uses the nonvalidating XML parser by default. We've shown only the directory attributes that are of interest to us. So far we've reviewed how the directory records look in XML. The stylesheets in Listings 2 and 3 demonstrate how Cocoon processes and transforms requests for directory lookup. You'll recognize all the XML tags in the stylesheets and relate them to the directory records returned from the search query. Figure 2 shows the Directory Server console after the install. Notice how iPlanet Directory Server creates branching points called organizational units (mnemonic: ou).
Importing LDIF Data
At this point we're ready to test the transformation to WML and SVG. However, there's one last configuration change we have to do before we can test-drive the clients.
Configuring Cocoon for SVG
Test Drive
Typing the same URL from IE browser on Windows, your SVG search result should be similar to Figure 6. Try the zoom in/zoom out features with the SVG client. You have now successfully tested this multiclient application!
Conclusion
Even though we've tested the server-side components on Solaris and the clients on Windows, the application should work equally well on other platforms. At the time of this writing, it's the authors' understanding that Microsoft's Active Directory Server's schema doesn't support the inetOrgPerson object class. We didn't focus on handling multiple search hits in a scalable manner. We suggest you look at iPlanet Directory Server's Virtual List View if you want to implement support for large search result sets. iPlanet Directory Server can also do soundex matches (~= search operator). Since WAP phones typically have more smarts than regular ones, the WAP application environment has a public WTAI (Wireless Telephony Applications Interface) that integrates the telephone and the WAP (micro) browser functions of a WAP device. In the case of our directory lookup application, you can use these functions to call a phone number from the search hit list, add it to the address book, and more. Cellular carriers usually run the WTAI servers. XML JOURNAL LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK BREAKING XML NEWS |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||