473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Posting to web app and reading result

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
Aug 22 '05 #1
0 1039

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dariusz | last post by:
Below is part of a code I have for a database. While the database table is created correctly (if it doesn't exist), and data is input correctly into the database when executed, I have a problem...
7
by: Scott Brady Drummonds | last post by:
Hi, everyone, I'm a Python novice and would love some tips on how I should perform the following task: I'd like to have my Python script read objects (using their constructors) and terminate...
145
by: David MacQuigg | last post by:
Playing with Prothon today, I am fascinated by the idea of eliminating classes in Python. I'm trying to figure out what fundamental benefit there is to having classes. Is all this complexity...
0
by: travis ray | last post by:
Hi, I have an extension in which a file object is created in python and passed down to a c extension which attempts to read from it or write to it. Writing to the file pointer seems to work...
1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
2
by: Stanley Beamish | last post by:
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...
6
by: KC | last post by:
How would I post data from a listbox that allows multiple selections? How do you join the name/value pairs for the posted data? And for extra credit: Where is a page posting to when there is no...
3
by: Peter Afonin | last post by:
Hello, I'm posting the data to another page and reading the results. I'm doing it approximately as described here: http://authors.aspalliance.com/stevesmith/articles/netscrape2.asp It works...
2
by: Joe | last post by:
Anyone can suggest the best method of reading XML and adding data to ListView? Here is the xml data structure:: <xml> <site> <url>http://www.yahoo.com</url> <lastupdate></lastupdate>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.