Results 1 to 5 of 5

Thread: Setting COS via SOAP

  1. #1
    liriarte is offline Member
    Join Date
    Sep 2007
    Location
    Argentina
    Posts
    10
    Rep Power
    7

    Default Setting COS via SOAP

    I am creating accounts via soap from java. Here is my code (it works):

    Code:
    Element request = Element.XMLElement.mFactory				.createElement(AdminService.CREATE_ACCOUNT_REQUEST);
    request.addAttribute(AdminService.E_NAME, name,Element.DISP_CONTENT);
    request.addAttribute(AdminService.E_PASSWORD, password, Element.DISP_CONTENT);
    Element response = trans.invoke(request);
    But I need to set the COS to the accounts and I cant do it. I tried something like this but it didnt work. Either I couldnt set firstname and lastname

    Code:
    request.addAttribute(AdminService.E_COS, cos,Element.DISP_CONTENT);
    or
    request.addAttribute(AdminService.E_COS, cos,Element.DISP_ELEMENT);
    In soap-admin.txt file I didnt found anything about this

    What can I do?
    Last edited by liriarte; 10-30-2007 at 04:55 AM.

  2. #2
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    Rather than rolling your own, have you tried using the methods in SoapProvisioning.java?
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    liriarte is offline Member
    Join Date
    Sep 2007
    Location
    Argentina
    Posts
    10
    Rep Power
    7

    Default

    Ok, I could set cos using SoapProvisioning.
    Where can I get the attributtes I can put in the map?

    Beacuse this example throws com.zimbra.soap.SoapFaultException: createAccount invalid attr name:

    Code:
    SoapProvisioning sp = new SoapProvisioning();
    		sp.soapSetURI("https://localhost:7071/"
    				+ ZimbraServlet.ADMIN_SERVICE_URI);
    		try {
    			sp.soapAdminAuthenticate("test", "aaaaa");
    			Map m=new HashMap();
    			m.put("firstName", "firstname");
    			m.put("lastName", "lastname");
    			sp.createAccount("aa@aa.tsavo.com", "aaaa", m);
    Last edited by liriarte; 10-31-2007 at 05:30 AM.

  4. #4
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    Look at the constants in Provisioning.java. You're dealing with standard LDAP attrs, so I believe first name is "cn" and last name is "sn"

    Another good thing to do is to do the operation from the web admin client with the debug window open -- you'll see the SOAP in the debug window. I believe that you can also turn on a verbose protocol dump from zmprov.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  5. #5
    liriarte is offline Member
    Join Date
    Sep 2007
    Location
    Argentina
    Posts
    10
    Rep Power
    7

    Default

    Yes it works, thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. Replies: 0
    Last Post: 10-24-2007, 09:35 AM
  3. Zimbra Install Problem - getDirectContext
    By bsimzer in forum Installation
    Replies: 27
    Last Post: 07-19-2007, 10:12 AM
  4. Replies: 13
    Last Post: 05-15-2007, 06:41 AM
  5. Replies: 9
    Last Post: 04-14-2007, 08:31 AM

Posting Permissions

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