Workflow Name: amset12createuser#
Constituent Services: AuthenticationService, AdministrationService, InitCreateUserWS, DateTimeWS#
Technical Notes#
Platform: GlassFishESB V2.1, NetBeans IDE 6.5.1 (including BPEL Designer, implementing WS-BPEL 2.0)
Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.0-b15
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb).
Alfresco Labs 3.1 Final running on remote server, 64-bit Java 1.6.0_13, Tomcat 6 on Red Hat Enterprise Linux 5.
Workflow Description#
User provisioning in Alfresco is dealt with by the AdministrationService. The WSDL-generated AdministrationService.createUsers() SOAP request (Code snippet 12.1) specifies only the username and password. Other user properties are submitted as an array of name-value pair properties.
Code snippet 12.1. Generated AdministrationService.createUsers() SOAP request.
<adm:createUsers>
<adm:newUsers>
<adm:userName></adm:userName>
<adm:password></adm:password>
<adm:properties>
<ns:name></ns:name>
<ns:isMultiValue></ns:isMultiValue>
<ns:value></ns:value>
<ns:values></ns:values>
</adm:properties>
</adm:newUsers>
</adm:createUsers>
The property options can be seen by looking at org.alfresco.webservice.utils.Constant.java in the source code.
Code snippet 12.2. User-related constants from Constants.java.
public static final String NAMESPACE_CONTENT_MODEL = "http://www.alfresco.org/model/content/1.0"; public static final String PROP_USERNAME = createQNameString(NAMESPACE_CONTENT_MODEL, "userName"); public static final String PROP_USER_HOMEFOLDER = createQNameString(NAMESPACE_CONTENT_MODEL, "homeFolder"); public static final String PROP_USER_FIRSTNAME = createQNameString(NAMESPACE_CONTENT_MODEL, "firstName"); public static final String PROP_USER_MIDDLENAME = createQNameString(NAMESPACE_CONTENT_MODEL, "middleName"); public static final String PROP_USER_LASTNAME = createQNameString(NAMESPACE_CONTENT_MODEL, "lastName"); public static final String PROP_USER_EMAIL = createQNameString(NAMESPACE_CONTENT_MODEL, "email"); public static final String PROP_USER_ORGID = createQNameString(NAMESPACE_CONTENT_MODEL, "organizationId");
Code snippet 12.3. createUsers element.
<adm:newUsers>
<adm:userName>magneto</adm:userName>
<adm:password>magnetopw</adm:password>
<adm:properties>
<ns:name>{http://www.alfresco.org/model/content/1.0}email</ns:name>
<ns:isMultiValue>false</ns:isMultiValue>
<ns:value>magneto@badmutants.com</ns:value>
<ns:values></ns:values>
</adm:properties>
</adm:newUsers>
Input/Output#
Code snippet 12.4. AdministrationService.createUsers() SOAP request.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2009-08-29T01:15:32.93+00:00</wsu:Created>
<wsu:Expires>2009-08-29T01:19:32.00+00:00</wsu:Expires>
</wsu:Timestamp>
<UsernameToken>
<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TICKET_3330d4ddff3693a3a2d94f2ca389c7a849e21662</Password>
<Username>admin</Username>
</UsernameToken>
</Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<createUsers
xmlns="http://www.alfresco.org/ws/service/administration/1.0" xmlns:msgns="http://www.alfresco.org/ws/service/administration/1.0">
<msgns:newUsers>
<msgns:userName>magneto</msgns:userName>
<msgns:password>magnetopw</msgns:password>
<ns0:properties
xmlns:adm="http://xml.netbeans.org/schema/administration"
xmlns:init="http://j2ee.netbeans.org/wsdl/amset12createuser/InitCreateUserWS"
xmlns:msgns="http://j2ee.netbeans.org/wsdl/amset12createuser/InitCreateUserWS"
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0" xmlns:ns0="http://www.alfresco.org/ws/service/administration/1.0">
<ns:name>{http://www.alfresco.org/model/content/1.0}email</ns:name>
<ns:isMultiValue>false</ns:isMultiValue>
<ns:value>magneto@badmutants.com</ns:value>
<ns:values/>
</ns0:properties>
</msgns:newUsers>
</createUsers>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Code snippet 12.5. AdministrationService.createUsers() SOAP response.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<createUsersResponse xmlns="http://www.alfresco.org/ws/service/administration/1.0">
<result>
<userName>magneto</userName>
<properties>
<ns1:name xmlns:ns1="http://www.alfresco.org/ws/model/content/1.0">{http://www.alfresco.org/model/content/1.0}name</ns1:name>
<ns2:isMultiValue xmlns:ns2="http://www.alfresco.org/ws/model/content/1.0">false</ns2:isMultiValue>
<ns3:value xmlns:ns3="http://www.alfresco.org/ws/model/content/1.0">0c6db7c2-fd31-48bc-9cf3-3c7af1b5214c</ns3:value>
</properties>
<properties>
<ns4:name xmlns:ns4="http://www.alfresco.org/ws/model/content/1.0">{http://www.alfresco.org/model/content/1.0}email</ns4:name>
<ns5:isMultiValue xmlns:ns5="http://www.alfresco.org/ws/model/content/1.0">false</ns5:isMultiValue>
<ns6:value xmlns:ns6="http://www.alfresco.org/ws/model/content/1.0">magneto@badmutants.com</ns6:value>
</properties>
<properties>
<ns7:name xmlns:ns7="http://www.alfresco.org/ws/model/content/1.0">{http://www.alfresco.org/model/system/1.0}node-dbid</ns7:name>
<ns8:isMultiValue xmlns:ns8="http://www.alfresco.org/ws/model/content/1.0">false</ns8:isMultiValue>
<ns9:value xmlns:ns9="http://www.alfresco.org/ws/model/content/1.0">537</ns9:value>
</properties>
<properties>
<ns10:name xmlns:ns10="http://www.alfresco.org/ws/model/content/1.0">{http://www.alfresco.org/model/content/1.0}sizeCurrent</ns10:name>
<ns11:isMultiValue xmlns:ns11="http://www.alfresco.org/ws/model/content/1.0">false</ns11:isMultiValue>
<ns12:value xmlns:ns12="http://www.alfresco.org/ws/model/content/1.0">0</ns12:value>
</properties>
<properties>
<ns13:name xmlns:ns13="http://www.alfresco.org/ws/model/content/1.0">{http://www.alfresco.org/model/content/1.0}userName</ns13:name>
<ns14:isMultiValue xmlns:ns14="http://www.alfresco.org/ws/model/content/1.0">false</ns14:isMultiValue>
<ns15:value xmlns:ns15="http://www.alfresco.org/ws/model/content/1.0">magneto</ns15:value>
</properties>
<properties>
<ns16:name xmlns:ns16="http://www.alfresco.org/ws/model/content/1.0">{http://www.alfresco.org/model/content/1.0}homeFolder</ns16:name>
<ns17:isMultiValue xmlns:ns17="http://www.alfresco.org/ws/model/content/1.0">false</ns17:isMultiValue>
<ns18:value xmlns:ns18="http://www.alfresco.org/ws/model/content/1.0">workspace://SpacesStore/7044de04-0334-4504-881e-0f82c5818e33</ns18:value>
</properties>
</result>
</createUsersResponse>
</soapenv:Body>
</soapenv:Envelope>
Note the various bits of info you get back on creating a user.
Figure 12.1. Magneto appears.
![]() |
An example is given below of creating a user with several properties.
Code snippet 12.6. Multiple properties SOAP request.
<soapenv:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:init="http://j2ee.netbeans.org/wsdl/amset12createuser/InitCreateUserWS" xmlns:adm="http://xml.netbeans.org/schema/administration" xmlns:ns="http://www.alfresco.org/ws/model/content/1.0">
<soapenv:Body>
<init:InitCreateUserWSOperation>
<username>admin</username>
<password>adminPassword</password>
<createUsers>
<adm:createUsers>
<adm:newUsers>
<adm:userName>hawkman</adm:userName>
<adm:password>hawkmanpw</adm:password>
<adm:properties>
<ns:name>{http://www.alfresco.org/model/content/1.0}email</ns:name>
<ns:isMultiValue>false</ns:isMultiValue>
<ns:value>hawkman@thanagar.com</ns:value>
<ns:values></ns:values>
</adm:properties>
<adm:properties>
<ns:name>{http://www.alfresco.org/model/content/1.0}firstName</ns:name>
<ns:isMultiValue>false</ns:isMultiValue>
<ns:value>carter</ns:value>
<ns:values></ns:values>
</adm:properties>
<adm:properties>
<ns:name>{http://www.alfresco.org/model/content/1.0}lastName</ns:name>
<ns:isMultiValue>false</ns:isMultiValue>
<ns:value>hall</ns:value>
<ns:values></ns:values>
</adm:properties>
</adm:newUsers>
</adm:createUsers>
</createUsers>
</init:InitCreateUserWSOperation>
</soapenv:Body>
</soapenv:Envelope>
Add new attachment
List of attachments
| Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
|---|---|---|---|---|---|---|
png |
magneto.png | 14.5 kB | 1 | 29-Aug-2009 02:13 | clayton |
