Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problems getting UTL_HTTP example from Oracle doc to work (client error 400 -- bad request)

Re: Problems getting UTL_HTTP example from Oracle doc to work (client error 400 -- bad request)

From: Yong Huang <yong321_at_yahoo.com>
Date: 21 Nov 2004 20:53:04 -0800
Message-ID: <b3cb12d6.0411212053.5817d2a5@posting.google.com>


rcholcomb1999-post_at_yahoo.com (Robert Holcomb) wrote in message news:<e0f934c3.0411180951.6341b14a_at_posting.google.com>...
> All,
>
> Below is the description of my problem. I've taken sample code
> directly out of the Oracle documentation
> (http://www.di.unipi.it/~ghelli/bdl/B10501_01/appdev.920/a96612/u_http.htm#1013135)
> and it doesn't work. I've slightly modified the example code to point
> at www.yahoo.com and commented out the proxy statement (because in IE
> I don't have a proxy set and my network doesn't have a proxy server).
> I get the error indicated at the bottom of this post.
>
> My version information
> ---------------------------------------
> Oracle9i Release 9.2.0.1.0 - Production
> JServer Release 9.2.0.1.0 - Production
>

...
>
> Error response when this code is executed in SQL Plus
> ---------------------------------------
>
> SQL> SET serveroutput ON SIZE 40000
> SQL>
> SQL> DECLARE
> 2 req utl_http.req;
> 3 resp utl_http.resp;
> 4 value VARCHAR2(1024);
> 5 BEGIN
> 6
> 7 -- utl_http.set_proxy('proxy.my-company.com',
> 'corp.my-company.com');
> 8
> 9 req := utl_http.begin_request('http://www.yahoo.com');
> 10 utl_http.set_header(req, 'User-Agent', 'Mozilla/4.0');
> 11 resp := utl_http.get_response(req);
> 12 LOOP
> 13 utl_http.read_line(resp, value, TRUE);
> 14 dbms_output.put_line(value);
> 15 END LOOP;
> 16 utl_http.end_response(resp);
> 17 EXCEPTION
> 18 WHEN utl_http.end_of_body THEN
> 19 utl_http.end_response(resp);
> 20 END;
> 21 /
> DECLARE
> *
> ERROR at line 1:
> ORA-29268: HTTP client error 400 - Bad Request
> ORA-06512: at "SYS.UTL_HTTP", line 1220
> ORA-06512: at line 11

Can you reproduce? I ran your code on my 10.1.0.2.0 database and got the result correctly (ignore the line length overflow error):

SQL> @c:\q
<html><head>
<script language=javascript>
var now=new Date,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,hp=0,cc='',ylp='';t1=now.getTime(); </script>
<title>Yahoo!</title>
DECLARE
*
ERROR at line 1:
ORA-20000: ORU-10028: line length overflow, limit of 255 chars per line

ORA-06512: at "SYS.DBMS_OUTPUT", line 35
ORA-06512: at "SYS.DBMS_OUTPUT", line 115
ORA-06512: at line 14

I don't think this is because I'm using 10g. Just try a few times and also against other sites.

Yong Huang Received on Sun Nov 21 2004 - 22:53:04 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US