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 03-16-2006, 11:14 AM
Active Member
 
Posts: 39
Question SOAP Request Questions (AccountModifyRequest and SetPasswordRequest)...

Hi!

I'm trying to manage my zimbra user accounts through SOAP requests in Cold Fusion. I have run into a few problems, though.

When I make a SOAP packet to perform the AccountModifyRequest, all updates go as planned except for one update; modifying the e-mail address itself (zimbraMailDeliveryAddress). It says that I do not have sufficient user rights (and I'm logged on as admin with a valid auth-token). Am I going about trying to update the address the wrong way? Or if I'm doing this right, what kind of access do I need?

My second question involves SetPasswordRequest. I get a response that the 'document is not found'; as if the function doesn't exist. I copied/pasted the SOAP request directly from the documentation, so I don't know what could be wrong. I'll post the SOAP here:

#defaultXmlHeader#
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<authToken>-My Valid Auth Token-</authToken>
</context>
</soap:Header>
<soap:Body>
<SetPasswordRequest>
<id>-The Account ID-</id>
<newPassword>-The Account Password-</newPassword>
</SetPasswordRequest>
</soap:Body>
</soap:Envelope>

Did I post the request wrong?

Finally, I have one more question; there is an Add/Remove Alias Request in the documentation but I could not find any requests to add and remove forwarding addresses. Do these requests exist or am I out of luck for now?

Thanks in advance for your time,
John
Reply With Quote
  #2 (permalink)  
Old 03-16-2006, 12:03 PM
Zimbra Employee
 
Posts: 4,792
Default

One idea to get SOAP call examples is use the debug window in the admin UI. Just login to the admin UI with ?debug=3 and it will dump each soap call. The setpasswordrequest should look like:

Code:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<sessionId id="1718"/>
<authToken>
AUTH TOKEN
</authToken>
</context>
</soap:Header>
<soap:Body>
<SetPasswordRequest xmlns="urn:zimbraAdmin">
<id>
ACCOUNT ID
</id>
<newPassword>
NEWPASS
</newPassword>
</SetPasswordRequest>
</soap:Body>
</soap:Envelope>
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #3 (permalink)  
Old 03-16-2006, 02:47 PM
Zimbra Employee
 
Posts: 228
Default

As KevinH pointed out, you are missing the xml namespace for the document:

Code:
<SetPasswordRequest xmlns="urn:zimbraAdmin">
As far as forwarding addresses, you can directly set the "zimbraMailForwardingAddress" attrs using ModifyAccount. There is a specific call for aliases because they are trickier, and require multiple updates in LDAP to reserve the DN of the alias, as well as update the alias entry on the account.
Reply With Quote
  #4 (permalink)  
Old 03-16-2006, 04:30 PM
Active Member
 
Posts: 39
Default

Quote:
Originally Posted by schemers
As KevinH pointed out, you are missing the xml namespace for the document:

Code:
<SetPasswordRequest xmlns="urn:zimbraAdmin">
As far as forwarding addresses, you can directly set the "zimbraMailForwardingAddress" attrs using ModifyAccount. There is a specific call for aliases because they are trickier, and require multiple updates in LDAP to reserve the DN of the alias, as well as update the alias entry on the account.
Thank you both. I hadn't realized I was missing the xmlns on it.

As far as the forwards go; each forward field that's returned from an account request is named exactly the same (zimbraMailForwardingAddress). How would I differentiate between them in my SOAP call to add and remove specific forwards?
Reply With Quote
  #5 (permalink)  
Old 03-16-2006, 04:48 PM
Zimbra Employee
 
Posts: 228
Default

For multi-value attrs (like zimbraMailForwardingAddress) you have a number of options:

- by default it replaces all of them. So calling ModifyAccount with:

Code:
<a n="zimbraMailForwardingAddress">v1</a>
<a n="zimbraMailForwardingAddress">v2</a>
will replace all existing values of zimbraMailForwardingAddress with the ones specified.

- you can explcitly and/remove a single value using a +/- in front of the attr name:

Code:
<a n="-zimbraMailForwardingAddress">v1</a>
<a n="+zimbraMailForwardingAddress">v2</a>
that will remove the "v1" value, and add a "v2" value. Any other values for that attribute will be left unchanged. If you use +/- in front of an attr name, you must you it in front of all values for that attr name in the same call.

- you can remove all values by setting a single instance to the value to "":

Code:
<a n="zimbraMailForwardingAddress"></a>
since "" means unset, and you haven't specified a +/-, it will delete all existing values.

For a while we only supported the first first and last forms, which is definitely a pain when you have a multi-valued attribute with a lot of values. Instead of making the protocol more complex, we decided to just add the +/- syntax in front of the attr name so it worked immediately with existing SOAP calls and also via "zmprov" and all the internal provisioning APIs.
Reply With Quote
  #6 (permalink)  
Old 03-17-2006, 08:38 AM
Active Member
 
Posts: 39
Default

Quote:
Originally Posted by schemers
For multi-value attrs (like zimbraMailForwardingAddress) you have a number of options:

- by default it replaces all of them. So calling ModifyAccount with:

Code:
<a n="zimbraMailForwardingAddress">v1</a>
<a n="zimbraMailForwardingAddress">v2</a>
will replace all existing values of zimbraMailForwardingAddress with the ones specified.

- you can explcitly and/remove a single value using a +/- in front of the attr name:

Code:
<a n="-zimbraMailForwardingAddress">v1</a>
<a n="+zimbraMailForwardingAddress">v2</a>
that will remove the "v1" value, and add a "v2" value. Any other values for that attribute will be left unchanged. If you use +/- in front of an attr name, you must you it in front of all values for that attr name in the same call.

- you can remove all values by setting a single instance to the value to "":

Code:
<a n="zimbraMailForwardingAddress"></a>
since "" means unset, and you haven't specified a +/-, it will delete all existing values.

For a while we only supported the first first and last forms, which is definitely a pain when you have a multi-valued attribute with a lot of values. Instead of making the protocol more complex, we decided to just add the +/- syntax in front of the attr name so it worked immediately with existing SOAP calls and also via "zmprov" and all the internal provisioning APIs.
Thank you! You have no idea how much that simplified everything for me XD.

The only question left to address is the user rights for modifying zimbraMailDeliveryAddress and then I'm good.
Reply With Quote
  #7 (permalink)  
Old 03-17-2006, 10:40 AM
Zimbra Employee
 
Posts: 228
Default

zimbraMailDeliveryAddress is the primary email address for an account, and also the name, so it should only be set on CreateAccount, and modified via RenameAccount.
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.