S
Stanley Beamish
Hello I'm an ASP newbie needing to translate a JAVA program into ASP. I
have a servlet that posts data to another servlet and reads back the
response. I was wondering how I could do the same in ASP. The bits of Java
code are:
HttpURLConnection conn = null;
try
{
URL url = new URL(urlStr);
System.out.println("Opening connection to: " + urlStr);
conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
System.out.println("Sending data to url");
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.println(text);
out.close();
System.out.println("Reading response.");
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer sb = new StringBuffer();
while ((inputLine = in.readLine()) != null)
{
sb.append(inputLine);
}
in.close();
System.out.println(sb.toString());
} catch (Exception e)
{
System.out.println(e.getMessage());
}
Any pointers greatly appreciated.
SB
have a servlet that posts data to another servlet and reads back the
response. I was wondering how I could do the same in ASP. The bits of Java
code are:
HttpURLConnection conn = null;
try
{
URL url = new URL(urlStr);
System.out.println("Opening connection to: " + urlStr);
conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
System.out.println("Sending data to url");
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.println(text);
out.close();
System.out.println("Reading response.");
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer sb = new StringBuffer();
while ((inputLine = in.readLine()) != null)
{
sb.append(inputLine);
}
in.close();
System.out.println(sb.toString());
} catch (Exception e)
{
System.out.println(e.getMessage());
}
Any pointers greatly appreciated.
SB