I have copied a block of code from the DFS_ECServices_reference_65.pdf guide for the C# routine of "getFormalRecordTemplatesInFilePlan" and attempted to run it after making a number of small changes relevant to my needs. Shown below is the code that I am using. I am providing valid credentials (I think) and the code is failing on the line "List<string> formalRecordTypes = formalRecordService.GetValidFormalRecordTypes(fileplanIdentity);" with the following error:
Service method "GetValidFormalRecordTypes" invocation failed.
Deeper in the error message is:
{"Could not connect to http://enzo2:9080/services/formalrecord/FormalRecordService. TCP error code 10061: No connection could be made because the target machine actively refused it 198.5.170.19:9080. "}
Any thoughts on what I am doing wrong?
Code:
public List<ObjectIdentity> getFormalRecordTemplatesInFilePlan()
{
ContextFactory contextFactory = ContextFactory.Instance;
RepositoryIdentity repository = new RepositoryIdentity();
repository.RepositoryName = repositoryName;
repository.UserName = userName;
repository.Password = password;
IServiceContext serviceContext = contextFactory.NewContext();
serviceContext.AddIdentity(repository);
ServiceFactory serviceFactory = ServiceFactory.Instance;
IFormalRecordService formalRecordService = serviceFactory.GetRemoteService<IFormalRecordService>(serviceContext, "formalrecord", "http://enzo2:9080/services");
ObjectIdentity fileplanIdentity = new ObjectIdentity();
fileplanIdentity.RepositoryName = repositoryName;
fileplanIdentity.ValueType = ObjectIdentityType.OBJECT_PATH;
fileplanIdentity.valueTypeSpecified = true;
fileplanIdentity.Value = new ObjectPath("/Cabinets/FormalCabinet/FMS");
List<string> formalRecordTypes = formalRecordService.GetValidFormalRecordTypes(fileplanIdentity); //FAILING LINE OF CODE
List<ObjectIdentity> templateIdentities = new List<ObjectIdentity>();
if (formalRecordTypes != null && formalRecordTypes.Count > 0)
{
foreach (String type in formalRecordTypes)
{
ObjectIdentitySet templateIdentitySet = formalRecordService.GetFormalRecordTemplates(type, repositoryName);
templateIdentities.AddRange(templateIdentitySet.Identities);
}
}
return templateIdentities;
}