public WSResponse_EDXTrigger TriggerEDXTask(string taskName, string password, string variableName, string variableValues, char variableValueDelimiter = ',')
        {
            WSResponse_EDXTrigger retVal = new WSResponse_EDXTrigger();

            List <string> variableValueList = new List <string>();
            var           o = variableValues.Split(variableValueDelimiter);

            if (o != null)
            {
                variableValueList = o.ToList <string>();
            }


            QmsAPI.QMSClient apiClient = new QmsAPI.QMSClient();

            // retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

            // get the default distribution service
            ServiceInfo qvsService = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();

            if (qvsService != null)
            {
                // run it on the first QlikView Distribution Service available
                TriggerEDXTaskResult result = apiClient.TriggerEDXTask(qvsService.ID, taskName, password, variableName, variableValueList);
                Guid execId = result.ExecId;

                if (result.EDXTaskStartResult == EDXTaskStartResult.Success)
                {
                    retVal.Succeeded = true;
                }
                else
                {
                    retVal.Succeeded = false;
                }
                retVal.StatusMessage = result.EDXTaskStartResult.ToString();
                retVal.ExecId        = (result.ExecId != Guid.Empty) ? result.ExecId.ToString() : null;


                Debug.WriteLine("EDXTaskStartResult: " + result.EDXTaskStartResult.ToString());
                Debug.WriteLine("ExecId: " + execId);
                Debug.WriteLine("~~");
            }
            else
            {
                retVal.Succeeded     = false;
                retVal.StatusMessage = "No Distribution service found.";
            }
            return(retVal);
        }
Ejemplo n.º 2
0
        public WSResponse_EDXTrigger TriggerEDXTask(string taskName, string password, string variableName, string variableValues, char variableValueDelimiter = ',')
        {
            WSResponse_EDXTrigger retVal = new WSResponse_EDXTrigger();

            List<string> variableValueList = new List<string>();
            var o = variableValues.Split(variableValueDelimiter);
            if (o != null)
            {
                variableValueList = o.ToList<string>();
            }

            QmsAPI.QMSClient apiClient = new QmsAPI.QMSClient();

            // retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

            // get the default distribution service
            ServiceInfo qvsService = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();

            if (qvsService != null)
            {
                // run it on the first QlikView Distribution Service available
                TriggerEDXTaskResult result = apiClient.TriggerEDXTask(qvsService.ID, taskName, password, variableName, variableValueList);
                Guid execId = result.ExecId;

                if (result.EDXTaskStartResult == EDXTaskStartResult.Success)
                {
                    retVal.Succeeded = true;
                }
                else
                {
                    retVal.Succeeded = false;
                }
                retVal.StatusMessage = result.EDXTaskStartResult.ToString();
                retVal.ExecId = (result.ExecId != Guid.Empty) ? result.ExecId.ToString() : null;

                Debug.WriteLine("EDXTaskStartResult: " + result.EDXTaskStartResult.ToString());
                Debug.WriteLine("ExecId: " + execId);
                Debug.WriteLine("~~");
            }
            else
            {
                retVal.Succeeded = false;
                retVal.StatusMessage = "No Distribution service found.";

            }
            return retVal;
        }