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 Role Names Using IdentityService4J API

Listing Role Names Using IdentityService4J API

The following sample snippet shows how to list roles using the identity service using the IdentityService4J API. The
com.activevos.examples.identityservice.FindAllRolesDemo
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.EmptyElement; import com.activevos.api.identityservice.wsdl.TRoleList; 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 findRoles() operation. TRoleList roleList = idServicePort.findRoles(new EmptyElement() ); List roleNames = roleList.getRole(); System.out.println("Found role count: " + roleNames.size()); for (String roleName : roleNames) { System.out.println("Role name: " + roleName); } } 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(); }