first my sample code:
AdministrationServiceSoapBindingStub administrationService = WebServiceFactory.getAdministrationService();
RepositoryServiceSoapBindingStub repositoryService= WebServiceFactory.getRepositoryService();
and few things to check the homefolder already exist and check if the users already exists.
// Create the new users
NewUserDetails[] newUsers = new NewUserDetails[1] ;
NewUserDetails newUser = new NewUserDetails(
userLogin, userPassword,
createPersonProperties(homeFolder,
userName, userMiddlename, userSurname,
userMail, userOrg));
UserDetails[] userDetails =
administrationService.createUsers(new NewUserDetails[]{newUser});
the createpersonprop function
private static NamedValue[] createPersonProperties(
String homeFolder,
String firstName,
String middleName,
String lastName,
String email,
String orgId)
{
// Create the new user objects
return new NamedValue[] {
new NamedValue(Constants.PROP_USER_HOMEFOLDER, false, homeFolder, null),
new NamedValue(Constants.PROP_USER_FIRSTNAME, false, firstName, null),
new NamedValue(Constants.PROP_USER_MIDDLENAME, false, middleName, null),
new NamedValue(Constants.PROP_USER_LASTNAME, false, lastName, null),
new NamedValue(Constants.PROP_USER_EMAIL, false, email, null),
new NamedValue(Constants.PROP_USER_ORGID, false, orgId, null)};
}
and finally the error on client side.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
i have found the sample code in org.alfresco.webservice.test.AdministrationServiceSystemTest
/**
* Administration service system test
*
* @author Roy Wetherall
*/
public class AdministrationServiceSystemTest extends BaseWebServiceSystemTest
{
private static Log logger = LogFactory.getLog(AdministrationServiceSystemTest.class);
public void testGetUsersBatching() throws Exception
{
int batchSize = 5;
QueryConfiguration queryCfg = new QueryConfiguration();
queryCfg.setFetchSize(batchSize);
WebServiceFactory.getAdministrationService().setHeader(
new RepositoryServiceLocator().getServiceName().getNamespaceURI(),
"QueryHeader",
queryCfg);
// Get the details of the new users
String homeFolder = store.getScheme() + "://" + store.getAddress() + "/" + folderReference.getUuid();
String one = Long.toString(System.currentTimeMillis());
String two = one + "2";
NewUserDetails[] newUsers = new NewUserDetails[] {
new NewUserDetails(
"user" + one,
"password" + one,
createPersonProperties(homeFolder, "first" + one, "middle" + one, "last" + one, "email" + one, "org" + one)),
new NewUserDetails(
"user" + two,
"password2" + two,
createPersonProperties(homeFolder, "first" + two, "middle" + two, "last" + two, "email" + two, "org" + two)) };
// Create the new users
WebServiceFactory.getAdministrationService().createUsers(newUsers);
UserQueryResults results = WebServiceFactory.getAdministrationService().queryUsers(null);
assertNotNull(results);
and at least the server version 2.1 RC1after all this problem the alfresco server working well.vincentps : great Jobs …