Does Connection Manager support Account Creation?

Hi,

Does ConnectionManager support account creation ?

On creating account through ConnectionManager, I am getting below mentioned exception.

Caused by: Server does not support account creation.:
at org.jivesoftware.smack.AccountManager.createAccount(AccountManager.java:221)

Is it a default behaviour ? If not, let me know how to enable account creation using “Connection Manager”.

FYI : I am using Connection Manager 3.6.3.

Thanks,

Mari

I am using this type of function to create new account / user in openfire using smack.

    /* ******************************************************************************* *******
     *
     * Description:- Registers a new user account into Openfire (XMPP) server
     *
     * Function Name:-    RegisterNewUser()
     *
     * Prameters Required:-       
     * XMPPConnection connection
     * String userName
     * String userPassword
     * String userFullName
     * String userEmail
     *
     * Return Type:- boolean
     *
     *                                       ******************************************************************************* */
   
public boolean RegisterNewUser(XMPPConnection connection, String userName,String userPassword,String userFullName,String userEmail,ZXMLStatus zStatus)

{
Map<String, String> newRegAttrMap = new HashMap<String, String>();

        String newStatus;
       
        if(userName == null || userName=="")
        {
            //Print ERROR message   
            return false;
        }
        if(connection == null)
        {
>                //Print ERROR message
           return false;
        }
        if(userPassword == null || userPassword =="")
        { 
            //Print ERROR message
            return false;
        }
        if(userFullName==null || userFullName=="")
        {
            //Print ERROR message
            return false;
        }
        if(userEmail==null || userEmail=="")
        { 
            //Print ERROR message
            return false;
        }                               
       
        newRegAttrMap.put("name"  , userFullName);
        newRegAttrMap.put("email" , userEmail);

        try
        {
            AccountManager manager = connection.getAccountManager();
            manager.createAccount(userName, userPassword, newRegAttrMap);
        }
        catch(XMPPException e)
        {                               
            //Print error message
            newStatus =  "UNABLE TO REGISTER";
           
            final XMPPError error = e.getXMPPError();
            int errorCode = 0;               
            if (error != null) {
                errorCode = error.getCode();                                      
               
                String errorDetails = getXMPPError(errorCode);
                //Print errorDetails
               
                newStatus += "  (ERROR-DETAILS ["+ errorCode +":- " + errorDetails + "]";                   
            }               
            return false;               
        }                       
        return true;
    }

Hope that will help you, also please correct me if i haven’t understood you properly

Regards,

Samba

Hi Samba/Soumya,

Thanks for effort.

Already I am able to create accounts in OpenFire using Smack API in usual way.After setting up Connection Manager(http://www.igniterealtime.org/projects/openfire/connection_manager.jsp) in Openfire, I tried to connect to port 5262, and then I tried to create accounts, but it got failed. Let me know, Am I missing anything w.r.t connection manager.

-Mari

Hello Dear . . .

I am using Smack3.0.2 to create new account as below code describe my account creation

try{

if (connection != null) {

accountManager= tConC.getAccountManager();

 Map<String,String> accouAttributes= new HashMap<String, String>();

 StringuserName=”testUser”;

 StringuserPass=”pass”;

 accouAttributes.put("first", "pm");

 accouAttributes.put("last", "pm");

 accouAttributes.put("email","pm@hellodomain.com");

boolean accountSupport=accountManager.supportsAccountCreation();

** if**(accountSupport){

accountManager.createAccount userName,userPass,accouAttributes);

}else{

System.*out*.print("Server NotSupporting");

}

}catch(XMPException ex){

ex.getMessage();

}

}

The thing is that supportsAccountCreation() returning me false

And When I try

accountManager.createAccount userName,userPass,accouAttributes);

without checking the supportAccountCreation() it give me exception.

Exception message as “Server does not support account creation”

I also try smack 3.2.1 that’s latest version of smack but it not solve my problem …

I try to create account on same server from PSI client it creating account successfully . . .

I am sure about server that it support the account creation . .

When I try XML manual account creation as give here http://xmpp.org/extensions/xep-0077.html called In-Band registration it works fine . .

Please give me suggestion where I am doing wrong ?

Thanks . . . .

Regards :

Aftab