Results 1 to 3 of 3

Thread: java program to creataccount

  1. #1
    Join Date
    Mar 2009
    Posts
    9
    Rep Power
    6

    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

  2. #2
    Join Date
    Nov 2007
    Location
    Detroit, MI
    Posts
    67
    Rep Power
    7

    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);

  3. #3
    Join Date
    Mar 2009
    Posts
    9
    Rep Power
    6

    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

Similar Threads

  1. Zimbra .pids / service monitoring
    By bin2hex in forum Administrators
    Replies: 24
    Last Post: 04-03-2010, 09:12 PM
  2. Replies: 0
    Last Post: 12-17-2008, 07:43 AM
  3. Tomcat, Java VM Problems - RAM related? Help
    By Mo_Hong in forum Administrators
    Replies: 3
    Last Post: 03-28-2007, 02:00 PM
  4. Java 1.5 crashing on PPC Mac 10.4.8
    By bradn in forum Installation
    Replies: 1
    Last Post: 12-08-2006, 05:27 PM
  5. Replies: 0
    Last Post: 12-04-2005, 01:34 PM

Posting Permissions

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