The Directory Services Markup Language v1.0 (DSMLv1) enables the representation of directory structural information as an XML document. DSMLv2 goes further, providing a method for expressing directory queries and updates (and the results of these operations) as XML documents. DSMLv2 documents can be used in a variety of ways. IBM TDI provides a Parser that can parse and create DSMLv2 request and response messages.
The DSMLv2 Parser is initialized with a DSMLv2 batch request or DSMLv2 batch response. Individual calls to read or write Entries will result in parsing or creation of individual DSML requests or responses (as parts of the batch request or response).
The Parser supports Delta tagging at the Entry level and the Attribute level. See also Multiple Attribute modifications.
The DSMLv2 Parser operates either in Server or in Client mode:
The DSMLv2 Parser supports Modify, Add, Delete, Search, ModifyDN, Compare, Auth and Extended operations.
Attention: The following TDI 6.0 DSMLv2 Parser custom helper objects from the ITIM DSML library are no longer supported:
Entries with the following structure are parsed (on read) and created (on write) by the parser for Modify Requests:
Attribute | Value |
---|---|
dsml.operation | set to "modifyRequest" |
dsml.base | holds the "dn" XML attribute of the DSML "modifyRequest" element |
$dn | holds the "dn" XML attribute of the DSML "modifyRequest" element |
Additionally, for each modification item: a TDI attribute named as the "name" XML attribute of the DSML "modification" element, with the values specified for the "modification" DSML element and TDI attribute's operation set as the "operation" XML attribute of the DSML "modification" element.
Entries with the following structure are parsed (on read) and created (on write) by the parser for Modify Responses:
Attribute | Value |
---|---|
dsml.operation | modifyResponse |
$dn | holds the "matchedDN" XML attribute of the DSML "modifyResponse" element |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "addResponse" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Search Requests:
Attribute | Value |
---|---|
dsml.operation | set to "searchRequest" |
$dn | holds the "matchedDN" XML attribute of the DSML "compareResponse" element |
dsml.base | holds the "dn" XML attribute of the DSML "searchRequest" element |
dsml.scope | holds the value of the "scope" attribute of the DSML "searchRequest" element |
dsml.filter | the LDAP filter that corresponds to the "filter" element of the DSML request |
dsml.attributes | the value of this attribute is a Vector or String whose elements hold the names of the attributes listed in the "attributes" element of the DSML request. |
dsml.derefAliases | holds the value of the "derefAliases" attribute of the DSML "searchRequest" element |
dsml.sizeLimit | holds the value of the "sizeLimit" attribute of the DSML "searchRequest" element |
dsml.timeLimit | holds the value of the "timeLimit" attribute of the DSML "searchRequest" element |
dsml.typesOnly | holds the value of the "typesOnly" attribute of the DSML "searchRequest" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Search Responses:
Attribute | Value |
---|---|
dsml.operation | set to "searchResponse" |
$dn | holds the "matchedDN" XML attribute of the DSML "searchResultDone" element of the DSML response |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
resultEntries | a multi-valued attribute, each of its values is a TDI Entry whose attributes correspond to the "attr" elements of the corresponding "searchResultEntry" element. |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Add Requests:
Attribute | Value |
---|---|
dsml.operation | set to "addRequest" |
dsml.base | holds the "dn" XML attribute of the DSML "addRequest" element |
$dn | holds the "dn" XML attribute of the DSML "addRequest" element |
Additionally, for each DSML attr element: a TDI Attribute named as the "name" XML attribute of the DSML "attr" element and as values specified for the "attr" DSML element.
Entries with the following structure are parsed (on read) and created (on write) by the parser for Add Responses:
Attribute | Value |
---|---|
dsml.operation | set to "addResponse" |
"$dn | holds the "matchedDN" XML attribute of the DSML "addResponse" element |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "addResponse" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Delete Requests:
Attribute | Value |
---|---|
dsml.operation | set to "deleteRequest" |
dsml.base | holds the "dn" XML attribute of the DSML "delRequest" element |
$dn | holds the "dn" XML attribute of the DSML "delRequest" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Delete Responses:
Attribute | Value |
---|---|
dsml.operation | set to "deleteResponse" |
$dn | holds the "matchedDN" XML attribute of the DSML "delRequest" element |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "addResponse" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for ModifyDN Requests:
Attribute | Value |
---|---|
dsml.operation | set to "modDnRequest" |
dsml.base | holds the "dn" XML attribute of the DSML "modDNRequest" element |
$dn | holds the "dn" XML attribute of the DSML "modDNRequest" element |
newrdn | holds the "newrdn" XML attribute of the DSML "modDNRequest" element |
dsml.newSuperior | holds the "newSuperior" XML attribute of the DSML "modDNRequest" element |
dsml.deleteOldRDN | holds the "deleteoldrdn" XML attribute of the DSML "modDNRequest" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for ModifyDN Responses:
Attribute | Value |
---|---|
dsml.operation | set to "modDnResponse" |
$dn | holds the "matchedDN" XML attribute of the DSML "modDNResponse" element |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "addResponse" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Compare Requests:
Attribute | Value |
---|---|
dsml.operation | set to "compareRequest" |
dsml.base | holds the "dn" XML attribute of the DSML "compareRequest" element |
$dn | holds the "dn" XML attribute of the DSML "compareRequest" element |
dsml.compare_name | holds the "name" XML attribute of the "assertion" element of the DSML request |
dsml.compare_value | holds the value of the "assertion" element of the DSML request |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Compare Responses:
Attribute | Value |
---|---|
dsml.operation | set to "compareResponse" |
$dn | holds the "matchedDN" XML attribute of the DSML "compareResponse" element |
dsml.compare_result | either "true" of "false" depending on whether the compare found match or not. When the Parser is used to create a DSML response, this attribute is required and depending on its value the Parser sets the right result code value. |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "addResponse" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Auth Requests:
Attribute | Value |
---|---|
dsml.operation | set to "authRequest" |
dsml.principal | holds the "principal" XML attribute of the DSML "authRequest" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Auth Responses:
Attribute | Value |
---|---|
dsml.operation | set to " authResponse" |
$dn | holds the "matchedDN" XML attribute of the DSML "authResponse" element |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response. |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "authResponse" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Extended Requests:
Attribute | Value |
---|---|
dsml.operation | set to "extendedRequest" |
dsml.extended.requestname | holds the "requestName" XML attribute of the DSML "extendedRequest" element |
dsml.extended.requestvalue | holds the "requestValue" XML attribute of the DSML "extendedRequest" element |
Entries with the following structure are parsed (on read) and created (on write) by the parser for Extended Response:
Attribute | Value |
---|---|
dsml.operation | set to "extendedResponse" |
$dn | holds the "matchedDN" XML attribute of the DSML "extendedResponse" element |
dsml.resultcode | holds the "code" XML attribute of the "resultCode" XML element of the DSML response |
dsml.resultdescr | holds the "descr" XML attribute of the "resultCode" XML element of the DSML response |
dsml.error | the presence of this attribute indicates an error condition and holds the value of the "errorMessage" XML element of the DSML response |
dsml.exception | holds a javax.naming.NamingException object that is used to automatically fill in the "code" and "descr" XML attributes of the "resultCode" XML element of the DSML response; if this attribute is specified, any values set to the "dsml.resultcode" and "dsml.resultdescr" Entry Attributes are ignored and replaced with data retrieved through the exception object. |
dsml.referral | holds a vector containing all referral URIs of the DSML "extendedResponse" element |
dsml.responseName | holds the "responseName" XML attribute of the DSML "extendedResponse" element |
dsml.response | holds byte array containing string which represents the response from an "extendedResponse" operation |
All invalid XML characters (as per the XML specification) are removed from the "dsml.error" Entry Attribute before serializing this attribute into DSML.
Entries with the following structure are parsed (on read) and created (on write) by the parser for Error Response:
Attribute | Value |
---|---|
dsml.operation | set to "errorResponse" |
dsml.errorType | holds the value of the "type" XML attribute of the DSML response XML element; must be one of "notAttempted", "couldNotConnect", "connectionClosed", "malformedRequest", "gatewayInternalError", "authenticationFailed", "unresolvableURI" or "other" |
dsml.message | holds the text value of the "message" XML element of the DSML response |
dsml.details | holds the value of the "detail" XML element of the DSML response |
When parsing DSML messages, attributes tagged as binary by the Binary Attributes Parser parameter are Base64 decoded, that is, the string value from the DSML message is Base64 decoded to Java byte array.
When creating DSML messages, all Attributes whose value is Java byte array are Base64 encoded to String before being written in the DSML message.
If when creating a DSML message an Attribute is passed whose value's type is neither String nor Java byte array, the value is converted to String by calling the object's "toString()" method and this String value is written in the DSML message.
The following optional attributes, when present, are parsed (on read) and created (on write) by the parser for all DSMLv2 Requests and Responses:
Attribute | Value |
---|---|
dsml.requestID | corresponds to the DSMLv2 "requestID" attribute. |
dsml.controls | holds Vector of raw com.ibm.ldap.dsml.DsmlControl objects. |
When reading, the Parser expects the values of DSMLv2 controls to be Base64 encoded. For example instead of a control element like this one:
<control type="1.2.840.113556.1.4.619" criticality="true"> <controlValue xsi:type="xsd:string">mycontrolvalue</controlValue> </control>
we need to provide a control element like the following:
<control type="1.2.840.113556.1.4.619" criticality="true"> <controlValue xsi:type="xsd:base64Binary">bXljb250cm9sdmFsdWU==</controlValue> </control>
This is a limitation of the underlying DSML library from IBM Directory Server (com.ibm.ldap.dsml.*). The DSMLv2 XML Schema (http://www.oasis-open.org/committees/dsml/docs/DSMLv2.xsd) allows controlValue elements to be of xsd:anyType. However, the IBM DS DSMLv2 library (obtained from TDS 6.1) ignores the xsi:type attribute and always attempts to base64 decode the value.
When setting the "dsml.resultcode" Attribute for DSML Response messages, allowed types are: java.lang.Integer and java.lang.String containing an integer value as string. This value corresponds to the integer "code" XML attribute of the "resultCode" DSML element and it is required by the DSMLv2 specification.
We can optionally set the "dsml.resultdescr" Attribute for DSML Response messages. This value corresponds to the "descr" XML attribute of the "resultCode" DSML element. It is not required by the DSMLv2 specification. When you assign a value to this attribute it is placed in the DSML response as is - no validation of the value (which is an enumerated string is done) and no check is performed whether this value corresponds to the mandatory integer "dsml.resultcode" Attribute.
The "code" and "descr" XML attributes of the "resultCode" DSML element can also be set through the "dsml.exception" Entry Attribute for DSML Response messages. This attribute can only accept javax.naming. NamingException objects. When "dsml.exception" attribute is set, the "code" and "descr" XML attributes of the "resultCode" DSML element are overwritten with new values extracted from the exception object. For example when the "dsml.exception" attribute is set to a javax.naming.AuthenticationException object, the "code" attribute will be set to the LDAP code of "49" and the "descr" attribute will be set to the LDAP description "inappropriateAuthentication".
The DSMLv2 Parser (and LDIF Parser) does not support multiple modifications over a single Attribute - the values from a modification are accumulated in the Attribute and the operation from the last modification is set as the operation tag for the Attribute. Therefore, the Parsers need to merge the modifications in an Entry in such way that the resulting Attribute modification be equivalent to the modifications for that Attribute in the modify operation. This can be achieved by using Attribute.ATTRIBUTE_MOD - a TDI-specific tagging at the Attribute level and by using AttributeValue level tagging - AttributeValue.AV_ADD, AttributeValue.AV_DELETE.
The following data flow rules will be used when accumulating modifications in an Attribute object:
The Parser needs the following parameters:
This Parser extends the Simple XML Parser; therefore, the same notices with regards to Character Encoding apply.
Specifies a comma delimited list of attributes that will be treated by the Parser as binary attributes.
The following attributes are specified as binary by default (but we can change this list):
If the DSMLv2 Parser is configured to run in "server" (read) mode and is passed the following DSMLv2 request:
<batchRequest onError="exit" processing="sequential" responseOrder="sequential" xmlns="urn:oasis:names:tc:DSML:2:0:core" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <addRequest requestID = "3" dn="cn=chavdar kovachev,o=ibm,c=us"> <attr name="objectclass"> <value>person</value> </attr> <attr name="telephoneNumber"> <value>555</value> </attr> <attr name="sn"> <value>kovachev</value> </attr> <attr name="cn"> <value>chavdar kovachev</value> </attr> </addRequest> </batchRequest>
it will generate an Entry object with the following Attributes:
If the DSMLv2 Parser is configured to run in "client" (write) mode and is passed an Entry with the following Attributes:
it will generate the following DSMLv2 request:
<?xml version="1.0" encoding="UTF-8"?> <batchRequest onError="exit" processing="sequential" responseOrder="sequential" xmlns="urn:oasis:names:tc:DSML:2:0:core" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <searchRequest requestID="7" derefAliases="neverDerefAliases" dn="o=ibm,c=us" scope="wholeSubtree" sizeLimit="0" timeLimit="0" typesOnly="false"> <filter> <present name="sn"/> </filter> <attributes> <attribute name="cn"/> <attribute name="sn"/> </attributes> </searchRequest> </batchRequest>