如何从servlet获取返回值到c#?我使用
将参数传递给servlet HttpWebRequest request = (HttpWebRequest)WebRequest
.Create("http://localhost:8080/value/Get_value?p_value=" +
passedValue);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
然后servlet将处理并将返回值传递给c#。
答案 0 :(得分:1)
您必须阅读响应缓冲区(流)。
...
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader reader=new StreamReader(response.GetResponseStream()))
{
string line = reader.ReadToEnd();
Console.WriteLine(line);
}