Код:
Код: Выделить всё
string message = @"
BB
";
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(@"http://www.webservicex.net/stockquote.asmx");
webRequest.Headers.Add(@"SOAPAction:http://www.webservicex.net/GetQuote");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Method = "POST";
XmlDocument soapEnvelopeXml = new XmlDocument();
soapEnvelopeXml.LoadXml(message);
using (Stream stream = webRequest.GetRequestStream())
{
soapEnvelopeXml.Save(stream);
}
using (WebResponse response = webRequest.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string soapResult = rd.ReadToEnd();
Console.WriteLine(soapResult);
}
}
Я пытаюсь получить доступ к очень простому веб-сервису с сайта www.webservicex.com. Ссылки приведены ниже.
Ссылка на службу: http://www.webservicex.net/stockquote.asmx
WSDL: http://www.webservicex.net/stockquote.asmx?WSDL
Подробнее здесь: https://stackoverflow.com/questions/464 ... om-c-sharp
Мобильная версия