예제 #1
0
        private PivotalCommand CreatePivotalCommand(string serverTaskName, string serverTaskMethodName, object[] parameters)
        {
            PivotalCommand command = PivotalCommand.CreateExecuteServerTaskCommand(
                pivotalSystemName, serverTaskName, serverTaskMethodName);

            command.Parameters = parameters;

            return(command);
        }
예제 #2
0
        public static PivotalCommand CreateExecuteServerTaskCommand(
            string pivotalSystemName, string serverTaskName, string serverTaskMethodName)
        {
            PivotalCommand cmd = new PivotalCommand();

            cmd.PivotalSystemName    = pivotalSystemName;
            cmd.ServerTaskName       = serverTaskName;
            cmd.ServerTaskMethodName = serverTaskMethodName;
            cmd.Parameters           = new object[0];
            return(cmd);
        }
예제 #3
0
        public async Task <object[]> Execute(PivotalCommand command)
        {
            HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
            if (timeoutms > 0)
            {
                HttpClient.Timeout = TimeSpan.FromMilliseconds(timeoutms);
            }

            var response = await HttpClient.PostAsync(pivotalXmlServicesUri, new StreamContent(new MemoryStream(Encoding.UTF8.GetBytes(command.ToString()))));

            response.EnsureSuccessStatusCode();

            return(ParseResponse(await response.Content.ReadAsStringAsync()));
        }
예제 #4
0
        public virtual Task <object[]> Execute(string serverTaskName, string serverTaskMethodName, params object[] parameters)
        {
            PivotalCommand command = CreatePivotalCommand(serverTaskName, serverTaskMethodName, parameters);

            return(Execute(command));
        }