Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-30-2007, 02:36 PM
New Member
 
Posts: 3
Default [SOLVED] Using CreateLDAPEntryRequest

I'm trying to figure out how to use CreateLDAPEntryRequest. I'm working in PHP on zimbra 4.5.7 with the ldap util extension installed. I have a number of other soap requests working fine, including GetLDAPEntrysRequest.

My current attempt looks like this:
<ns1:CreateLDAPEntryRequest>
<dn>uid=john.test,ou=people,dc=example,dc=com</dn>
<a n="l">Flagstaff</a>
</ns1:CreateLDAPEntryRequest>

This throws an error:
<soap:faultstring>system failure: createLDAPEntry</soap:faultstring>

and further down a ways in the detail:
Caused by: javax.naming.NamingException: [LDAP: error code 80 - no structuralObjectClass operational attribute]; remaining name 'uid=john.test,ou=people,dc=fh,dc=org'

I've tried a number of variations, but this is the closest I get.

Is there documentation somewhere for this that I'm missing? What's the proper syntax, and what am I doing wrong?

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-04-2007, 01:12 PM
New Member
 
Posts: 3
Default Using the proper call for the purpose helps

I figured out what I was doing wrong. So I thought I'd post the answer in case anybody else is trying to figure out how to use these.

I was trying to use CreateLDAPEntryRequest to add an attribute to an existing record. It doesn't do that. It adds new records. To add attributes I should have been using ModifyLDAPEntryRequest.

A simplistic use of CreateLDAPEntryRequest looks like this:

<CreateLDAPEntryResponse xmlns="urn:zimbraAdmin">
<LDAPEntry name="Foo Bar">
<a n="sn">Bar</a>
<a n="objectClass">organizationalPerson</a>
<a n="cn">Foo Bar</a>
</LDAPEntry>
</CreateLDAPEntryResponse>

This is obviously useless in the Zimbra context, but it is an example of a working SOAP call.

A working ModifyLDAPEntryRequest looks like this:

<ns1:ModifyLDAPEntryRequest>
<dn>uid=dtest,ou=people,dc=example,dc=com</dn>
<a n="l">Anytown</a>
<a n="street">101 East Main Street</a>
</ns1:ModifyLDAPEntryRequest>

Again, you wouldn't actually do that for these attributes, since ModifyAccountRequest would be more appropriate here, but this does show the working syntax for ModifyLDAPEntryRequest.

And a working GetLDAPEntrysRequest looks like this (the ldapSearchBase and query are just typical LDAP values)

<ns1:GetLDAPEntrysRequest>
<ldapSearchBase>dc=com</ldapSearchBase>
<query>( &amp; (co=US)(givenName=*Dav*))</query>
</ns1:GetLDAPEntrysRequest>
Reply With Quote
  #3 (permalink)  
Old 12-05-2007, 08:11 AM
Zimlet Guru & Moderator
 
Posts: 467
Default

Quote:
Originally Posted by dcaylor View Post
I figured out what I was doing wrong. So I thought I'd post the answer in case anybody else is trying to figure out how to use these.

I was trying to use CreateLDAPEntryRequest to add an attribute to an existing record. It doesn't do that. It adds new records. To add attributes I should have been using ModifyLDAPEntryRequest.

A simplistic use of CreateLDAPEntryRequest looks like this:

<CreateLDAPEntryResponse xmlns="urn:zimbraAdmin">
<LDAPEntry name="Foo Bar">
<a n="sn">Bar</a>
<a n="objectClass">organizationalPerson</a>
<a n="cn">Foo Bar</a>
</LDAPEntry>
</CreateLDAPEntryResponse>

This is obviously useless in the Zimbra context, but it is an example of a working SOAP call.

A working ModifyLDAPEntryRequest looks like this:

<ns1:ModifyLDAPEntryRequest>
<dn>uid=dtest,ou=people,dc=example,dc=com</dn>
<a n="l">Anytown</a>
<a n="street">101 East Main Street</a>
</ns1:ModifyLDAPEntryRequest>

Again, you wouldn't actually do that for these attributes, since ModifyAccountRequest would be more appropriate here, but this does show the working syntax for ModifyLDAPEntryRequest.

And a working GetLDAPEntrysRequest looks like this (the ldapSearchBase and query are just typical LDAP values)

<ns1:GetLDAPEntrysRequest>
<ldapSearchBase>dc=com</ldapSearchBase>
<query>( &amp; (co=US)(givenName=*Dav*))</query>
</ns1:GetLDAPEntrysRequest>
Thanks for the info!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.