Ejemplo n.º 1
0
        private static void Send(XDocument transactionDocument)
        {
            using (var client = new HttpClient())
            {
                client.Timeout = TimeSpan.FromMinutes(5);
                var    request = new HttpRequestMessage(HttpMethod.Post, Dataset.GetWfsClient());
                Stream stream  = new MemoryStream();
                transactionDocument.Save(stream);
                stream.Position = 0;
                request.Content = new StreamContent(stream);


                var response = client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result;

                var responseMessage = GetResponseMessage(response);

                if (!response.IsSuccessStatusCode)
                {
                    throw new TransactionAbortedException(
                              $"Transaction failed. Message from WFS-server: \r\n{responseMessage}");
                }

                WriteTransactionSummaryToConsole(responseMessage);
            }
        }
Ejemplo n.º 2
0
        private static void Send(XNode transactionDocument)
        {
            using (var client = new HttpClient())
            {
                var response = client.PostAsync(Dataset.GetWfsClient(), GetHttpContent(transactionDocument));

                if (!response.Result.IsSuccessStatusCode)
                {
                    throw new TransactionAbortedException(
                              $"Transaction failed. Message from WFS-server: \r\n{GetResponseErrorMessage(response)}");
                }

                WriteTransactionSummaryToConsole(response);
            }
        }