Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic 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 August 25th, 2005, 03:08 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 302 Error from the websever

Hi list,







I am developing a perl script to check the status of a database.



The Scenario:

I have a

http://<webserver>/xxx/login page where I enter the username, password and the schema information and then, when a button ‘login’ is pressed, it takes us to one more page



http://<webserver>/xxx/main where I need to select a DB and then, click ‘GO’ button and this is where I can start doing many things inside the database.



If the DB is down, we get a message ‘DOWN DB’ or else, we have a message ‘succcess’. I want to use these return string from the web server in my perl script and check the status.



All the above can be achieved by passing the below string in the browser (where the username, password and the schema is for the fields in the ‘login’ page and the contextid specifies the database which has to be selected in the ‘main’ page) ...

http://<webserver>/xxx/main?USE_CASE=GO&schema=TEST&contextid=TEST&userna me=xyz&password=aaa



When the above string is given in the browser, it works and takes me to the page that I need if the DB is up and running.



But when I use the POST command (after connecting to the web server) in the perl script, I get ‘302 Moved Temporarily...error. This is my POST command



POST /xxx/main HTTP/1.0

Content-Length: 64

Content-Type: application/x-www-form-urlencoded



USE_CASE=GO&schema=TEST&contextid=TEST&username=xy z&password=aaa



And the response is:



HTTP/1.0 302 Moved Temporarily

Date: Tue, 23 Aug 2005 11:39:12 GMT

Server: Rational_Web_Platform/1.0 (Win32) mod_jk/1.2.0

Set-Cookie: cqweb_session=hovbuWERz4GF@F2jlBUh4zDZEaW119p;Path =/cqweb

Set-Cookie: JSESSIONID=2C8EF55F0CB06682DD2CB40CD3017BC6;Path=/cqweb

Location: http://localhost/xxx/main?null

Content-Length: 0

Connection: close

Content-Type: text/html; charset=UTF-8



I am not sure what I missed, any help would be highly appreciated as this is very critical my work.



This is a Apache-Tomcat web server.



Thanks a ton
 
Old August 25th, 2005, 11:30 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Is main a page or a folder, if a folder then possibly because when you type the URL into the browser it receives the 302 as well but silently redirects to the default page for the folder. Try adding the full URL:
POST /xxx/main/index.jsp HTTP/1.0

Replace index.jsp with the name of the default page for main.



--

Joe (Microsoft MVP - XML)
 
Old September 2nd, 2005, 05:41 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanq for your reply, Joe.

I used the session ID on the reply from the server and posted the same message again to the webserver and it works now.

Thanks again...






Similar Threads
Thread Thread Starter Forum Replies Last Post
where can i download beginning C# isbn:7-302-05333 yuanhuajie C# 3 October 11th, 2008 04:37 AM
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Urgent: need code of ISBN 7-302-06322-2 lxjjxl_mail1 Forum and Wrox.com Feedback 1 August 8th, 2005 11:19 PM
need code!! ISBN:7-302-06574-8 zdp120 Wrox Book Feedback 2 February 12th, 2004 02:18 PM
need code!! ISBN:7-302-05565-3 solo822 Wrox Book Feedback 2 February 4th, 2004 09:16 AM





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