DSML-RPC (Directory Service Markup Language RPC)
use XML::Parser; use DSML;
my $parser = new XML::Parser(); $parser->setHandlers( Start => \&start, End => \&end, Char => \&char);
$parser->parse($dsml); my $obj = GetRequest(); .... # Do LDAP operation .... ErrorResponse($msg->error_name, $msg->error_text) if ($error); # Request isn't search GeneralResponse($obj->reqType, $msg->code, $msg->error_name) unless($error); # Request is search SearchResponse($msg);
This module use XML::Parser to parse DSML document and build a structure which contain all element to make requests to an LDAP server.
This is the handler for XML::Parser Start.
This is the handler for XML::Parser End.
This is the handler for XML::Parser Char.
Return an DSML::Request object which contains information to make LDAP operation. This object is created during parsing of XML.
Return a scalar which contains result of LDAP operation. It is in XML.
If LDAP operation returns an error, this method build an XML that contains name of error and a short descrption of it.
This method get in input a Net::LDAP::Search object returned by Net::LDAP search method and build an XML from it.
This method build an XML for other LDAP Operation. It get type of operation (modifyRequest, addRequest, delRequest, ...), result code and a short description of it.
the Net::LDAP manpage, the XML::Parser manpage
This module is based on DSMLv2.xsd contained in this distribution. I made some changes to original XML schema definition because I needed information about host, port (to contact LDAP server), username and password (to authenticate on LDAP server).
Sevastian Foglia <sf@yacme.com> YACME s.r.l. <http://www.yacme.com>
Copyright (c) 2004 YACME s.r.l. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.