Retrieve a service instance ID

You can retrieve a service instance ID for a component that cannot be configured for high availability. Components that can be configured for high availability have a core service instance and a host service instance. The following code sample retrieves an AttachmentConnector service instance ID.
Before you begin: Retrieve the serviceID integer for the service that you want to find the service instance ID of.
  1. Create the integer for the service instance ID.
    int serviceInstanceID;
  2. Invoke findServiceInstancesByService().
    FindServiceInstancesByService request = new findServiceInstancesByService();
    request.serviceId = serviceID;
    request.locale = locale;
    request.includeStatus = false;
    request.includeExtendedData=true;
    request.loadServiceConsumerRelationships=false;
    request.loadServiceConsumerRelationships=false;
    FindServiceInstancesByServiceResponse response = coreWebService.findServiceInstancesByService(request);
  3. Check the result for errors and handle any errors.
    if (result.findServiceInstancesByServiceReturnStatus.code != FindServiceInstancesByServiceReturnStatusEnumType.SUCCESS) 
    {    
    	    // handle any errors
    } 
  4. Loop through the result and, since there is only one AttachmentConnector service instance, store the first one that is found.
    for (int j = 0; j < serviceInstanceResult.serviceInstances.Length; j++)
    {
        if (serviceInstanceResult.serviceInstances[j].GetType().Equals(typeof(AttachmentConnectorServiceInstance)))
        {
            serviceInstanceID = serviceInstanceResult.serviceInstances[j].serviceId;
        }
    }/
Previous topic: Retrieve a service ID

Was this information helpful? Send us your comments.