Calling a Java Servlet from C #

Is this possible, and if so, can someone point me in the right direction.

thank

+3
source share
4 answers

You need to explain what you mean by calling, but you can definitely use the web client to send an HTTP request to the remote URL and get the result:

using (var client = new WebClient())
{
    string result = client.DownloadString("http://example.com/yoursevletaddress");
    // TODO: do something with the returned content from the servlet
}
+4
source

You can use HttpWebRequest as below

Request HttpWebRequest = (HttpWebRequest) WebRequest.Create ("HTTP: // sanserver: 8080 / IoSystem / ToAdd CheckLetter = SAN");

// Run the request

HttpWebResponse response = (HttpWebResponse) request.GetResponse ();

+2

Java Servlet:

- Java Java EE API- Java Servlet, , Java HTTP. - , . "" "HTTP Servlet".

- "" HTTP-. .net HttpWebRequest .

+2

. http- URL-, , . -

http://myservlet.com?dbItem1=ipAddress&dbItem2=trackingInfo

Then the servlet can act as a database or any other. I had a servlet spitting out XML that is pretty much ready to read in C #. The answer can be made using HttpWebRequestand read using HttpWebResponse.

0
source

Source: https://habr.com/ru/post/1781664/


All Articles