Пример #1
0
        public async Task<XDocument> SendCommandAsync(string baseUrl, uService service, string command, string postData, string header = null)
        {
            var serviceUrl = service.ControlURL;
            if (!serviceUrl.StartsWith("/"))
                serviceUrl = "/" + serviceUrl;

            var response = await PostSoapDataAsync(new Uri(baseUrl + serviceUrl), "\"" + service.ServiceType + "#" + command + "\"", postData, header)
                .ConfigureAwait(false);

            using (var stream = response.Content)
            {
                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    return XDocument.Parse(reader.ReadToEnd(), LoadOptions.PreserveWhitespace);
                }
            }
        }
Пример #2
0
        public async Task <XDocument> SendCommandAsync(string baseUrl, uService service, string command, string postData, string header = null)
        {
            var serviceUrl = service.ControlURL;

            if (!serviceUrl.StartsWith("/"))
            {
                serviceUrl = "/" + serviceUrl;
            }

            var response = await PostSoapDataAsync(new Uri(baseUrl + serviceUrl), "\"" + service.ServiceType + "#" + command + "\"", postData, header)
                           .ConfigureAwait(false);

            using (var stream = response.Content)
            {
                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    return(XDocument.Parse(reader.ReadToEnd(), LoadOptions.PreserveWhitespace));
                }
            }
        }