The references to various
this
properties are set in the same class where I get the values from a configuration file for the staging and production servers.public bool Publish(string fileUri)
{
try
{
ArrayList documents = new ArrayList(1);
IxiaClientServices IxiaCS = new IxiaClientServices();
IxiaServerServices IxiaSS = IxiaCS.ConnectServer(this.ContextServer);
IxiaDocBaseServices IxiaDS = IxiaSS.ConnectDocBase(this.ContextContainer);
IxiaDocumentServices ds = IxiaDS.DocumentServices;
IxiaDocument document = IxiaDocument.getInstance();
FileInfo file = new FileInfo(fileUri);
document.Name = file.Name;
document.MimeType = "text/xml";
document.Collection = this.ContextAdditionalName;
document.Content = IxiaDocument.MakeBinaryContent(file.FullName);
documents.Add(document);
IxiaTextmlServerError [] err = ds.SetDocuments(documents,
(int)IxiaDocumentServices.TextmlSetDocuments.TextmlAddDocument |
(int)IxiaDocumentServices.TextmlSetDocuments.TextmlReplaceDocument |
(int)IxiaDocumentServices.TextmlSetDocuments.TextmlIndexDocument,
TextmlDocumentType.TextmlDocument);
// If there is more than one item, and that first item is
// not null or empty, return false.
if (err.Length > 1 && !String.IsNullOrEmpty(err[0].ToString()))
{
// TODO: Log each in the EventViewer
return false;
}
else return true;
}
catch (Exception ex)
{
// TODO: Log in the EventViewer
return false;
}
}
I need to do the same into MarkLogic so I'll post that snippet here as soon as it's done.
No comments:
Post a Comment