Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How do I create a user account via the Web Services?

How do I create a user account via the Web Services?

Problem:

How do I create a user account via the Web Services?

Resolution:

The following code samples will be provided in the Java programming language.

Firstly we must login and obtain a session id which will allow us to interact with SilkCentral via the Web Services. This is achieved by calling the logonUser method of the sccsystem service, as shown in the below snippet:

//Connect to the sccsystem web service
SccsystemSoapBindingStub binding;
try {

binding = (SccsystemSoapBindingStub)
new SystemServiceServiceLocator().getsccsystem();

}
catch (Exception e) {

e.printStackTrace();

}

//logon to a SilkCentral session us
long sessionID = -3;
try{

sessionID = binding.logonUser("admin", "admin");
System.out.println(value);

}
catch(Exception e){

e.printStackTrace();

}

Now that we have successfully obtained a session id we can now move on with creating a user account via the Web Services. The steps involved in this process will require us to connect to the sccentities service, that contains the createUser method, which will subsequently allow us to create our user account via the web services. To connect to the sccentities Web Service see the following snippet:

//Connect to the sccentities web service
SccentitiesSoapBindingStub entBind;
try{

entBind = (SccentitiesSoapBindingStub) new MainEntitiesServiceLocator().getsccentities();

}
catch(Exception e){

e.printStackTrace();

}


Now that we can use the sccentities Web Service, we can now proceed with creating our user account. To perform this action via the Web Services we must make use of the UserDetails class, an instance of which will hold all the required details for our user account. See the following code snippet for the creation of a UserDetails instance and its creation via the Web Services:

//try to create the user
UserDetails newUser;
int iArray = {0}

try{
//Setup the User Details

newUser = new UserDetails();
newUser.setRoleId(5);
newUser.setAssignedProjects(iArray);
newUser.setEMail("test@borland.com");
newUser.setTimeZoneId("Europe/Belfast");
newUser.setDateFormat("EEE, MMM dd, yyyy - h:mm:ss a");
newUser.setShortDateFormat("M/d/yyyy, h:mm a");
newUser.setFirstDayOfWeek(2);
newUser.setPageRefreshTime(10);
newUser.setSeparatorString(",");
newUser.setLogin("Web_Service_User");
newUser.setFirstName("Some_Name");
newUser.setIsLocked(false);

//create the User
int i = entBind.createUser(sessionID, newUser);

}
catch(Exception e){

e.printStackTrace();

}


When the above snippet is executed, the corresponding user account will be created within SilkCentral Test Manager.


Old KB# 25166

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:53
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.