directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudheer Kumar <sudheerarim...@gmail.com>
Subject How to bind and search binary data in Apache DS?
Date Sat, 28 Feb 2009 06:06:07 GMT
Hi, I am new to LDAP and Apache DS.  Kindly help me solve my problem.

I have an attribute with binary (m-syntax: 1.3.6.1.4.1.1466.115.121.1.5) as
its type.  This attribute is  added as an attribute to an Object class.  I
tried to bind a String value (xml) to it.  Using the following line of code.


       String xml = getXml();


       LdapContext.modifyAttributes(dn,
                                new ModificationItem[] { new
ModificationItem(

DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(

"myAttributeName", xml)) })




It throws an exception saying: "ERROR Ldap server exception: [LDAP: error
code 80 - OTHER: failed for     Modify Request
        Object :
'cn=sudheer,ou=Preferences,ou=My_Org_Name,ou=Applications,dc=myorg,dc=com'
            Modification[0]
                Operation :  replace
                Modification
    myattributeName: '0x3C 0x3F 0x78 0x6D 0x6C 0x20 0x76 0x65 0x72 0x73 0x69
0x6F 0x6E 0x3D 0x22 0x31 ...'
            Modification[1]
                Operation :  replace
                Modification
    myattributeNametimestamp: 1233046896765: java.lang.String]
ERROR Failed to save home pages in LDAP."

Converting the String to byte array ( byte[] contentInBytes =
xml.getBytes()) doesn't solve the problem.  Then just for verification I
read a jpeg file using BufferedInputStream and extracted the content to a
byte array. This time it successfully stored the byte array data.  However,
when retrieving the data back, what I am getting is a Char array. Why it
doesn't return a byte array?  How do I store String values in binary format?
Please help.


-- 
Sudheer Kumar Arimbra

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message