Esempio n. 1
0
        IWebRequest BuildPostRequest(string serviceToExecute, string payload, AuthenticationType authenticationType, string userName, string password, bool isDebug)
        {
            var escapeUriString = Uri.EscapeUriString(serviceToExecute);
            var req             = _webRequestFactory.New(escapeUriString);

            req.Method = "POST";
            UpdateRequest(authenticationType, userName, password, isDebug, req);

            var data = Encoding.ASCII.GetBytes(payload);

            req.ContentType   = "application/x-www-form-urlencoded";
            req.ContentLength = data.Length;
            req.Headers.Add("Warewolf-Execution-Id", DataObject.ExecutionID.ToString());

            using (Stream requestStream = req.GetRequestStream())
            {
                requestStream.Write(data, 0, data.Length);
                requestStream.Close();
            }
            return(req);
        }