Hello,
I am invoking a
servlet from an application. But it doesnt seem to work. It doesnt give an exception either. Here is teh code i used
mport java.net.URL;
import java.net.URLConnection;
import java.io.*;
class HTTPS1
{
public static void main(
String args[])
{
HTTPS1 url = new HTTPS1();
url.connectToUrl();
}
public void connectToUrl()
{
try
{
URL url = new URL("http://mildh0679:7070/gem/servlet/gem.BatchReportServlet?ACTION=BATCH");
System.out.println("Trying to connect to URL - " + url);
URLConnection con = url.openConnection();
System.out.println("con - " + con);
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type", "application/x-java-serialized-object");
OutputStream os = con.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(os);
ObjectOutputStream oos = new ObjectOutputStream(bos);
System.out.println("writing hello");
oos.writeObject("hello");
oos.flush();
oos.close();
System.out.println("closed");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Any clues on this?