Table of Contents

Search

  1. Preface
  2. Overview, Downloading, and Installing
  3. Administration API
  4. Identity Service API
  5. Screenflow Programming and SDK
  6. ActiveVOS WSHT API
  7. Embedding Request Forms in Standalone Web Pages
  8. XML-JSON for Process Central

7. APIs, SDKs, and Services

7. APIs, SDKs, and Services

Listing Identities Using the IdentityService4J API

Listing Identities Using the IdentityService4J API

This sample snippet illustrates using the
findIdentitiesByRole()
operation. The
com.activevos.examples.identityservice.FindIdentitiesByRoleDemo
class file has the complete example.
import com.activevos.api.identityservice.AeIdentityService; import com.activevos.api.identityservice.IdentitySearchPortType; import com.activevos.api.identityservice.SearchFault; import com.activevos.api.identityservice.wsdl.TIdentityList; import com.activevos.api.identityservice.xsd.TIdentity; import com.activevos.api.identityservice.xsd.TProperty; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import javax.xml.namespace.QName; /** Identity Service endpoint WSDL */ String ID_SERVICE_WSDL = "http://localhost:8080/active-bpel/services/AeIdentityService?wsdl"; /** Identity Service endpoint QName */ QName ID_SERVICE_QNAME = new QName( "http://docs.active-endpoints/wsdl/identity/2007/03/identity.wsdl", "AeIdentityService"); try { // Create service using WSDL location and service qname. AeIdentityService idService = new AeIdentityService(new URL(ID_SERVICE_WSDL), ID_SERVICE_QNAME); // Get service port to invoke operations. IdentitySearchPortType idServicePort = idService.getAeIdentityServicePort(); // Invoke findIdentitiesByRole() operation. // In this example, get the list of identities for role 'loanreps'. TIdentityList idList = idServicePort.findIdentitiesByRole("loanreps"); // get list of Identities from resultset List<TIdentity> identities = idList.getIdentity(); System.out.println("Found identities count: " + identities.size()); for (TIdentity identity : identities) { System.out.println("ID: " + identity.getId()); // id, such as DN of LDAP entry. // List of roles this person belongs to. List<String> memberRoles = identity.getRoles().getRole(); for (String role : memberRoles) { System.out.println("Member Of : " + role); } // List all attributes. E.g. firstName, lastName, email etc. List<TProperty> properties = identity.getProperties().getProperty(); for (TProperty prop : properties) { System.out.println("property[" + prop.getName() + "] = " + prop.getValue() ); } System.out.println(); } } catch(MalformedURLException mue) { // Invalid service url format mue.printStackTrace(); } catch(SearchFault searchFault) { // identity service related fault. System.out.println("Fault Message: " + searchFault.getMessage()); if (searchFault.getFaultInfo() != null) { // Fault details. System.out.println("FaultInfo Code: " + searchFault.getFaultInfo().getCode()); System.out.println("FaultInfo Message: " + searchFault.getFaultInfo().getMessage()); } searchFault.printStackTrace(); } catch(Exception e) { e.printStackTrace(); }