Crowd ships with Java integration libraries that allow you to create a Crowd client (also known as a Crowd-connected application) with minimal effort. This page gives a small demo of a stand-alone Crowd client to help you get started with using these libraries.
SOAP API is no longer available
SOAP API has been removed in Crowd 5.0. For information on how to migrate to REST API, see Crowd SOAP to REST migration guide.
For further help and questions on Crowd development, please see answers from the community.
If you do not yet have an application defined in Crowd, go ahead and create one via the Crowd Administration Console under 'Applications'.
Copy the files from your Crowd installation folder CROWD_INSTALL/client
for your project. These are the contents from a Crowd 1.6 installation:
1 2- crowd-integration-client-X.X.jar (Crowd Integration Library) + lib (libraries you will need to include in your CLASSPATH) + conf -- crowd.properties (Settings for defining where your Crowd Server is, and what the Application you're trying to connect to is) -- crowd-ehcache.xml (Settings for Crowd Client cache)
Modify your local copy of crowd.properties
such that crowd.server.url
, application.name
and application.password
match the URL of your Crowd server and the application name and password you just defined.
1 2import com.atlassian.crowd.integration.service.soap.client.SecurityServerClientFactory; import com.atlassian.crowd.integration.service.soap.client.SecurityServerClient; import com.atlassian.crowd.integration.authentication.PasswordCredential; import com.atlassian.crowd.integration.soap.SOAPPrincipal; import com.atlassian.crowd.integration.soap.SOAPAttribute; import com.atlassian.crowd.integration.model.UserConstants; public class CrowdClientDemo { public static void main(String[] argv) { SecurityServerClient crowdClient = SecurityServerClientFactory.getSecurityServerClient(); try { crowdClient.authenticate(); SOAPPrincipal principal = new SOAPPrincipal("test-user"); principal.setActive(true); principal.setAttributes(new SOAPAttribute[]{ new SOAPAttribute(UserConstants.EMAIL, "test@example.com"), new SOAPAttribute("givenName","Paul"), new SOAPAttribute("sn","Smith") }); PasswordCredential pwd = new PasswordCredential("secret"); crowdClient.addPrincipal(principal,pwd); } catch (Exception e) { System.err.println(e.toString()); } } }
crowd.properties
and crowd-ehcache.xml
are in your classpath. You can force it to use a specific location with the option java CrowdSOAPClient -Dcrowd.properties=/path/to/the/crowd.properties
.If you prefer not to use the Crowd integration libraries and want to interface via the SOAP service directly, that can be done as well. In fact, the Crowd integration libraries actually use SOAP to communicate to the Crowd Server. One practical reason why you may want to interface via SOAP directly is to avoid the possibility of updating the Crowd Client libraries if they change in the future. Please see the example in the Axis 1.x client stub generation guide that performs the same function as the above example.
Java Integration Libraries Creating a Crowd Client for your Custom Application
Rate this page: