Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: [SOLVED] create a user programatically!!

  1. #11
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,016
    Rep Power
    24

    Default

    Are you using the correct username and password; and the correct location ? please let us know what parameters you are using to checkout ?

  2. #12
    jayanth is offline Active Member
    Join Date
    May 2010
    Posts
    37
    Rep Power
    4

    Default

    hello ,

    i am using "public" as username and password as"public1234" url is:"codes.zimbra.com:2666"

  3. #13
    jayanth is offline Active Member
    Join Date
    May 2010
    Posts
    37
    Rep Power
    4

    Default

    Quote Originally Posted by uxbod View Post
    Are you using the correct username and password; and the correct location ? please let us know what parameters you are using to checkout ?
    Hello,

    i downloaded the source code , but if i am using the old java user creation code it is giving so many errors. I added so many jar files . But still it is showing recursing errors .

    So , can u help me making request from java program . I new to SOAP . so can u just give one example for making soap request from java program.

  4. #14
    jayanth is offline Active Member
    Join Date
    May 2010
    Posts
    37
    Rep Power
    4

    Default getting javax.net.ssl.SSLHandshakeException while creating a user using java

    Hello ,
    first i am trying to get the authtoken frm the server it is throwing this exception how can i resolve this?

    the program is:------------------------

    package com.renintech.Admin;
    import com.zimbra.common.service.ServiceException;
    //import com.zimbra.cs.service.account.AccountService;
    //import com.zimbra.cs.service.admin.AdminService;
    import com.zimbra.common.soap.Element;
    //import com.zimbra.common.soap.SoapFaultException;
    import com.zimbra.common.soap.SoapHttpTransport;
    //import com.zimbra.common.soap.ZimbraSoapContext;
    public class createUser {

    public static void main(String a[])
    {
    SoapHttpTransport trans = null;
    Element response = null;
    try {
    System.out.println("1");
    trans = new SoapHttpTransport("https://192.168.1.254:7071/service/admin/soap");
    System.out.println("2");
    Element request = Element.XMLElement.mFactory .createElement("AdminService.AuthRequest");
    System.out.println("3");
    request.addAttribute("AdminService.name","admin@re n014.renintech.com",Element.Disposition.CONTENT);
    request.addAttribute("AdminService.password", "jayanth",Element.Disposition.CONTENT);
    response = trans.invoke(request);
    } catch (Exception e) {
    e.printStackTrace();
    }
    String authToken = null;
    // get the auth token out, no default, must be present or a service exception is thrown
    try {
    authToken = response.getAttribute("AccountService.AuthResponse ");
    System.out.println(authToken);
    } catch (ServiceException e) {
    //
    e.printStackTrace();
    }
    // get the session id, if not present, default to null
    String sessionId = response.getAttribute("ZimbraSoapContext.E_SESSION _ID", null);
    System.out.println(sessionId);
    trans.setAuthToken(authToken);
    if (sessionId != null)
    trans.setSessionId(sessionId);
    }
    }




    if i am executing this i am getting this exception:


    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLExceptio n(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(U nknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Un known Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Un known Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serv erCertificate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.proc essMessage(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoo p(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_re cord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRec ord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.perform InitialHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRe cord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write (Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at java.io.FilterOutputStream.flush(Unknown Source)
    at org.apache.commons.httpclient.methods.StringReques tEntity.writeRequest(StringRequestEntity.java:150)
    at org.apache.commons.httpclient.methods.EntityEnclos ingMethod.writeRequestBody(EntityEnclosingMethod.j ava:495)
    at org.apache.commons.httpclient.HttpMethodBase.write Request(HttpMethodBase.java:1973)
    at org.apache.commons.httpclient.HttpMethodBase.execu te(HttpMethodBase.java:993)
    at org.apache.commons.httpclient.HttpMethodDirector.e xecuteWithRetry(HttpMethodDirector.java:397)
    at org.apache.commons.httpclient.HttpMethodDirector.e xecuteMethod(HttpMethodDirector.java:170)
    at org.apache.commons.httpclient.HttpClient.executeMe thod(HttpClient.java:396)
    at com.zimbra.common.soap.SoapHttpTransport.invoke(So apHttpTransport.java:280)
    at com.zimbra.common.soap.SoapHttpTransport.invoke(So apHttpTransport.java:206)
    at com.zimbra.common.soap.SoapTransport.invoke(SoapTr ansport.java:356)
    at com.zimbra.common.soap.SoapTransport.invoke(SoapTr ansport.java:319)
    at com.renintech.Admin.createUser.main(createUser.jav a:23)
    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unkno wn Source)
    at sun.security.validator.PKIXValidator.engineValidat e(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl. checkServerTrusted(Unknown Source)
    at com.sun.net.ssl.internal.ssl.JsseX509TrustManager. checkServerTrusted(Unknown Source)
    ... 23 more
    Caused by: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder. engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 28 more
    Exception in thread "main" java.lang.NullPointerException
    at com.renintech.Admin.createUser.main(createUser.jav a:30)

  5. #15
    jayanth is offline Active Member
    Join Date
    May 2010
    Posts
    37
    Rep Power
    4

    Cool user creation successful using java

    i modified the code like this, then i am able to create a user

    package com.xxxx.Admin;
    import java.util.HashMap;
    import java.util.Map;
    import com.zimbra.common.service.ServiceException;
    import com.zimbra.cs.account.Account;
    import com.zimbra.cs.account.soap.SoapProvisioning;
    public class Usercreate1 {

    /**
    * @param args
    */
    final static String FNAME = "Joe";
    final static String LNAME = "Shmoe";
    final static String ADDRESS = "101 Market Street";
    final static String CITY = "San Francisco";
    final static String STATE = "CA";
    final static String POSTALCODE = "94105";
    static private Account createZimbraAccount;
    public static void main(String[] args) {
    Map<String, Object> map = new HashMap<String, Object>();
    try {
    map.put("gn", FNAME);
    map.put("sn", LNAME);
    map.put("street", ADDRESS);
    map.put("l", CITY);
    map.put("st", STATE);
    map.put("postalCode", POSTALCODE);
    } catch (Exception e) {
    e.printStackTrace();
    }

    try {
    System.out.println("in try1");
    SoapProvisioning sp = new SoapProvisioning();
    System.out.println(1);
    sp.soapSetURI("https://192.168.1.254:7071/service/admin/soap");

    System.out.println(2);
    sp.soapAdminAuthenticate("admin@ren014.xxxx.com"," jayanth");
    //sp.
    System.out.println(3);
    createZimbraAccount = sp.createAccount("a5@ren014.xxxx.com", "password", map);
    System.out.println("created successcully");
    }
    catch(ServiceException se) {
    se.printStackTrace();
    }
    }}

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] mysql.server not running
    By king0770 in forum Administrators
    Replies: 23
    Last Post: 07-25-2009, 03:07 PM
  2. [SOLVED] Zimbra logwatch.
    By nishith in forum Administrators
    Replies: 5
    Last Post: 06-10-2009, 04:42 PM
  3. Can't create new user accounts
    By fabioneves in forum Installation
    Replies: 11
    Last Post: 12-03-2008, 05:45 AM
  4. auto create user from Active Directory
    By yattamax in forum Administrators
    Replies: 2
    Last Post: 11-12-2007, 11:04 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
  •