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 04-02-2009, 06:59 AM
Junior Member
 
Posts: 9
Default java program to creataccount

Hi All,
I Installed zimbra 5 version and working fine. I can able to create account by using "zmprov ca myname@mydomin.com password". But my requirement is to do it programatically.
I want to create the zimbra account once the user create the account in my java project. In my java project i use srvlet code to enter user details in the MYSQL table. Once my account is created i want to create the zimbra account with the same user name and password . Is it possible to create account through SOAP. If so how???????? I have seen in PHP they are using the SOAP connection to create account. But i dont know PHP??????? I want to create the account through JAVA.
Is it possible to complete my requirement???????? If so how

1) What are all the jar files need from zimbra to call createaccount from my java file?????
2) What are all the fields present in the createaccount method.

Is ZimbraId field is mandatory?? if so how we can generate zimbraId ??????

thanks in advance.

Regards,
thangavel
Reply With Quote
  #2 (permalink)  
Old 04-02-2009, 10:44 PM
Project Contributor
 
Posts: 67
Default

Hello, this should be close to what you are looking for.. It creates a calendar resource (zimbra user) via Java:

Code:
<%@ page import="com.zimbra.cs.account.soap.*" %>
<%@ page import="com.zimbra.common.soap.*" %>
<%@ page import="com.zimbra.common.soap.Element.XMLElement" %>
<%@ page import="com.zimbra.common.service.ServiceException" %>
Code:
// Standard SOAP URL on the local host
String soapurl = "https://127.0.0.1/service/soap/";
// Admin SOAP URL on the local host
String adminsoapurl = "https://127.0.0.1:7071/service/admin/soap/";
Code:
SoapProvisioning sp = new SoapProvisioning();
sp.soapSetURI(adminsoapurl);                      
sp.soapAdminAuthenticate(adminuser,adminpassword);       
SoapHttpTransport soapHttpTransport = new SoapHttpTransport(sp.soapGetURI());
soapHttpTransport.setAuthToken(sp.getAuthToken());

XMLElement req = new XMLElement("CreateCalendarResourceRequest");
req.addAttribute("xmlns", "urn:zimbraAdmin");
Element name = req.addElement("name").setText(resname.concat("@").concat(thisserver));

Element pass = req.addElement("password").setText(pw1.toString());
req.addElement("a").addAttribute("n","displayName").setText(request.getParameter("name"));
req.addElement("a").addAttribute("n","zimbraCalResType").setText("Equipment");
Element tagsResponse = soapHttpTransport.invoke(req);
Reply With Quote
  #3 (permalink)  
Old 04-02-2009, 11:30 PM
Junior Member
 
Posts: 9
Default

thank you ab

The code seems to be JSP code. I want to know the method and parameters to pass to create account in zimbra. I also have the following queries
1) Did we want to add any zimbra jar files to our java class path??? if so what are all the jar files i want to copy to my class path???
2) What is the exact method to call for create account in zimbra soap????

This may be simple question. But i am very new to zimbra

Again thank you ab

Regards
thangavel
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.