Results 1 to 7 of 7

Thread: SOAP Request Questions (AccountModifyRequest and SetPasswordRequest)...

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Daytona Beach, FL
    Posts
    39
    Rep Power
    9

    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

  2. #2
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    19

    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>
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

  3. #3
    Join Date
    Aug 2005
    Posts
    228
    Rep Power
    10

    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.

  4. #4
    Join Date
    Nov 2005
    Location
    Daytona Beach, FL
    Posts
    39
    Rep Power
    9

    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?

  5. #5
    Join Date
    Aug 2005
    Posts
    228
    Rep Power
    10

    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.

  6. #6
    Join Date
    Nov 2005
    Location
    Daytona Beach, FL
    Posts
    39
    Rep Power
    9

    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.

  7. #7
    Join Date
    Aug 2005
    Posts
    228
    Rep Power
    10

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •