Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 2nd, 2007, 08:31 PM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default calling a java servlet from a asp.net page

Hi,

I was wondering if somebody could tell me how to call a java servlet from an asp.net page and process the value returned from the servlet.

Im working with a servlet that does exactly what I need. Basically I enter one value and it returns another.

I've tried using httpResonse, httpRequest as follows>

************************************************** ***

string getVars = "1234567";

            HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(string.Format("h ttp://localhost:80/demo1_res{0}",getVars));

            WebReq.Method = "GET";

            HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();



            Stream Answer = WebResp.GetResponseStream();
            StreamReader _Answer = new StreamReader(Answer);

************************************************** ****

If I were to run the servlet by its self I enter a number into a text box and press submit. The submit button action is called "demo1_res".

I need a way to call the servlet passing the parameter and execute the method?

But i get this error
"System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()"

Im very new to all of this and im not really too sure how to approach the problem.

Thanks

Dub
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling java Servlet from ascx page pradeepnair74 BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 October 7th, 2008 07:31 AM
Calling WMI from ASP.Net Web Page vikingsunil ASP.NET 1.0 and 1.1 Professional 1 June 28th, 2007 08:54 AM
Calling WMI from ASP.Net Web Page vikingsunil ASP.NET 1.0 and 1.1 Professional 0 June 7th, 2007 05:19 AM
calling java servlet from javascript bearfacts Javascript How-To 1 August 26th, 2004 04:57 PM



All times are GMT -4. The time now is 03:11 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.