-4

I want to receive data from this URL http://XXXXXX:7777/online?user=ir-U-butaneco&pass=ir-Ue724679821pars6843560G1P1S (web server continuously sends data).

I want to write a program in C# that reads the data and stores it in SQL. I don't have any data about the web service also WSDL description.

Thanks for your help

I wrote this code:

WebRequest request = WebRequest.Create("http://XXXX:7777/online?user=ir-U-butaneco&pass=ir-Ue724679821pars6843560G1P1S");
request.Method = "GET";

WebResponse response = request.GetResponse();

Console.WriteLine("Content type is {0}", response.ContentType);
Console.WriteLine(((HttpWebResponse)response).StatusDescription);

Stream dataStream = request.GetRequestStream();    <-- error 
dataStream = response.GetResponseStream();

StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();

Console.WriteLine(responseFromServer);

I get this error:

Cannot send a content-body with this verb-type

  • You have **absolutely no documentation** about this service?? Do you even know whether it's a SOAP or REST service?? Without ***ANY*** knowledge about this service, we cannot really help you to get this to work - you need to know at least what type of service it is, and what methods (or resources for REST) it offers..... – marc_s Jan 19 '19 at 13:15

1 Answers1

1

To receive data from a website you will need to make a HTTP GET request. Please check the answer provided by @Aydin Adn in this post: C# how to properly make a http web GET request

Javi
  • 889
  • 1
  • 16
  • 41