Receive data in C# from web service












-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











share|improve this question




















  • 1





    Welcome to Stack Overflow! Please read what this site is about and "How to ask" before asking a question.

    – Stefan Becker
    Jan 19 at 7:49











  • 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 at 13:15
















-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











share|improve this question




















  • 1





    Welcome to Stack Overflow! Please read what this site is about and "How to ask" before asking a question.

    – Stefan Becker
    Jan 19 at 7:49











  • 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 at 13:15














-4












-4








-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











share|improve this question
















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








c#






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 19 at 13:17







Nader Zare

















asked Jan 19 at 6:55









Nader ZareNader Zare

11




11








  • 1





    Welcome to Stack Overflow! Please read what this site is about and "How to ask" before asking a question.

    – Stefan Becker
    Jan 19 at 7:49











  • 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 at 13:15














  • 1





    Welcome to Stack Overflow! Please read what this site is about and "How to ask" before asking a question.

    – Stefan Becker
    Jan 19 at 7:49











  • 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 at 13:15








1




1





Welcome to Stack Overflow! Please read what this site is about and "How to ask" before asking a question.

– Stefan Becker
Jan 19 at 7:49





Welcome to Stack Overflow! Please read what this site is about and "How to ask" before asking a question.

– Stefan Becker
Jan 19 at 7:49













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 at 13:15





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 at 13:15












1 Answer
1






active

oldest

votes


















0














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






share|improve this answer
























  • I wrote This Code but i get error

    – Nader Zare
    Jan 19 at 8:14













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54264784%2freceive-data-in-c-sharp-from-web-service%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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






share|improve this answer
























  • I wrote This Code but i get error

    – Nader Zare
    Jan 19 at 8:14


















0














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






share|improve this answer
























  • I wrote This Code but i get error

    – Nader Zare
    Jan 19 at 8:14
















0












0








0







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






share|improve this answer













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







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 19 at 7:48









JaviJavi

4141932




4141932













  • I wrote This Code but i get error

    – Nader Zare
    Jan 19 at 8:14





















  • I wrote This Code but i get error

    – Nader Zare
    Jan 19 at 8:14



















I wrote This Code but i get error

– Nader Zare
Jan 19 at 8:14







I wrote This Code but i get error

– Nader Zare
Jan 19 at 8:14




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54264784%2freceive-data-in-c-sharp-from-web-service%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage