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, 04:46 AM
Member
 
Posts: 10
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..
Reply With Quote
  #2 (permalink)  
Old 10-30-2007, 09:24 PM
Zimbra Employee
 
Posts: 1,434
Default

Rather than rolling your own, have you tried using the methods in SoapProvisioning.java?
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #3 (permalink)  
Old 10-31-2007, 04:37 AM
Member
 
Posts: 10
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..
Reply With Quote
  #4 (permalink)  
Old 10-31-2007, 10:30 AM
Zimbra Employee
 
Posts: 1,434
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!
Reply With Quote
  #5 (permalink)  
Old 11-01-2007, 01:32 PM
Member
 
Posts: 10
Default

Yes it works, thanks.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

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.