Question

I have setup a Tomcat server on one of my machines. On that server I have deployed my Pentaho Kettles. I have machine name and port number through which I can call that server from my other machine by simply typing in URL window. I am also passing the parameter values to my Pentaho kettles within same url. As soon as it hits Tomcat server parameters gets their values from url and kettles are executed.

But in actual scenario I have to call this tomcat server from a C# code. That URL I will have to generate and call from c# code only.

Please provide any code samples for same. Thanks in Advance!!

Was it helpful?

Solution

HttpWebRequest class can be used to post request and get response.

My only requirement is to hit URL of machine where I have deployed Tomcat Sever. Simple few lines of code can be used:

public void WebRequest(string url)
    {
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

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

        lblResults.Text = response.StatusDescription;
    }

Url passed to this method is prepared in simple string variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top