Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 2nd, 2007, 08:31 PM
Registered User
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default calling a java servlet from a asp.net page


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.



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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.