Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Web Services

Reply
Contributor
scmurdock
Posts: 15
Registered: ‎01-14-2012
My Device: Developer

BWS USER_CREATION_FAILED

Hello- I'm creating users in BWS, but adding Account details causes the below error:

 

23:23:33,146 INFO  [stdout] (http--0.0.0.0-8080-1) Error occured: ONE_OR_MORE_FAILURES
23:23:33,147 INFO  [stdout] (http--0.0.0.0-8080-1) Individual responses - Code: USER_CREATION_FAILED Message: Failed to create user: Internal error

 

The code I'm using is below. The code works if I remove the line "newUser.setAccountAttributes(accountAttributes);" but then the user isn't created right in BES (no email).

 

 

			CreateUsersRequest createUsersRequest = new CreateUsersRequest();
			createUsersRequest.setMetadata(connect.get_meta());

			NewUser newUser=new NewUser();

			UserAttributes userAttributes=new UserAttributes();

			//enable user to logon with BAS authenticator
			userAttributes.setAuthenticator(connect.getAdAuthenticator());//Active Directory

			userAttributes.setLoginName(userId);
			userAttributes.setLoginPassword("l@bP@ssw0rd");
			userAttributes.setDisplayName(userId);
			userAttributes.setRoleUid(connect.getDefaultRole().getUid());
			userAttributes.setDomain(adDomain);	   
						
			newUser.setUserAttributes(userAttributes);

			   //use this mail account
			AccountAttributes accountAttributes=new AccountAttributes();
			accountAttributes.setEmailAddress(userId+"@"+mailDomain);
			newUser.setAccountAttributes(accountAttributes);

			// select a BlackBerry Enterprise Server to create the user on
			newUser.setServer(connect.getServer());

			createUsersRequest.getNewUsers().add(newUser);

			CreateUsersResponse createUsersResponse = connect.get_bws().createUsers(createUsersRequest);

			if (createUsersResponse.getReturnStatus().getCode().compareTo("SUCCESS")!=0) {
				System.out.println("Error occured: " + createUsersResponse.getReturnStatus().getCode());
			}

 

 

Any help is appreciated.

 

Sean

 

 

 

 

 

 

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: BWS USER_CREATION_FAILED

Can you create this user from the BAS console with the same information?

Does the user need access to the BAS?

Could you provide some sample information which you are using to populate the below request? userId is usually used to reference the numerical ID of the user in the BAS.

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
harrids
Posts: 3
Registered: ‎02-17-2012
My Device: none

Re: BWS USER_CREATION_FAILED

Same issue here... Can't create users with an accountattributes set. Any resolution?

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: BWS USER_CREATION_FAILED

Please respond with the information requested in my previous post.

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
harrids
Posts: 3
Registered: ‎02-17-2012
My Device: none

Re: BWS USER_CREATION_FAILED

I have admin@mushroom.com exchange mailbox set up (Exchange/BES installed side-by-side on the same machine) and I'm trying to create BES user for it.

 

1. Yes, I can successfully create this user from the administration console.

2. Hm, I guess not... yet. Does it matter?

3. Here's the sample code:

var userAttributes = new UserAttributes
{
	authenticator = ADAuthenticator,
	loginName = "admin@mushroom.com",
	loginPassword = "P@ssw0rd"
	domain = "ad.domain.name",
	displayName = "admin@mushroom.com",
	roleUid = defaultRole.uid
};

var accountAttributes = new AccountAttributes();
accountAttributes.emailAddress = "admin@mushroom.com";

var server = GetServer();
var newUser = new NewUser
{
	userAttributes = userAttributes,
	accountAttributes = accountAttributes,
	server = server
};

var createUsersRequest = new CreateUsersRequest
{
	metadata = _metadata,
	newUsers = new[] { newUser }
};

var response = BwsService.createUsers(createUsersRequest);

 

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: BWS USER_CREATION_FAILED

When you create the user from the BAS console do you also provide credentials to allow them to login to the BAS console?
Could you try without special characters specified in the password?
Could you try without UserAttributes (these ae only required if you would like the user to have access to the BAS)?
Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
harrids
Posts: 3
Registered: ‎02-17-2012
My Device: none

Re: BWS USER_CREATION_FAILED

Leaving out UserAttributes helped, thank you.

But... why error happens anyway? Removing special characters in the password didn't help.
Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: BWS USER_CREATION_FAILED

Could be an issue with the domain used, can you confirm it's correct and works when trying to login to the BAS console?

 

Garett
@garettBeuk
--
Goodbye everybody!