This discussion is archived
1 Reply Latest reply: Oct 20, 2010 12:54 PM by Srini Chavali-Oracle RSS

utl_http.request_pieces returns unreadable chanracters

462358 Newbie
Currently Being Moderated
Hi,

The utl_http.request_pieces returning unreadable characters.
I have a procedure which gets data from rss feeds and put into a table.
It was working fine, but for last few daysutl_http.request_pieces returning some weird characters.
Tried UTL_HTTP.set_body_charset, but not working.

Pasting the code snippets
.........
.........
.........
rss_resp XMLType;
item_xml XMLType;
resp_string varchar2(32000);

pieces utl_http.html_pieces;
total_items Number;

PROCEDURE copy_rss_feeds_to_local_tab is
CURSOR usecase_sources_cs IS
SELECT DISTINCT(usecase_source_url)
FROM usecase_source
ORDER BY usecase_source_url;
BEGIN
UTL_HTTP.set_transfer_timeout(180);
for src_rss in (SELECT DISTINCT(source_rss)
FROM usecase_source order by source_rss)
loop
resp_string:='';

select us.USECASE_SOURCE_ID, us.USECASE_SOURCE_TYPE_ID into source_id, source_type from usecase_source us where us.source_rss = src_rss.source_rss;
dbms_output.put_line('character set ' || UTL_HTTP.get_body_charset());
UTL_HTTP.set_body_charset('WE8MSWIN1252');

pieces := utl_http.request_pieces(src_rss.source_rss,3200,'www-proxy.idc.oracle.com:80');
UTL_HTTP.set_body_charset('WE8MSWIN1252');

dbms_output.put_line('new character set ' || UTL_HTTP.get_body_charset());

FOR i in 1 .. pieces.count loop
resp_string := resp_string|| to_char(pieces(i));

dbms_output.put_line('Piece : ' || i || ' : ' || resp_string );

END LOOP;
dbms_output.put_line( 'Response String ' || length(trim(resp_string) ));
rss_resp := XMLType(resp_string);

.........
.........
.........

pieces will return unreadable characters ‹
and the following exception is thrown during xml parsing ie in the line rss_resp := XMLType(resp_string);

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00216: invalid character 31 (0x1F)
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 310
ORA-06512: at "BUGREGRESS.RSS_FEED_PKG", line 63
ORA-06512: at line 2
'TopLink/JPA
TOPLINK
character set ISO-8859-1
new character set WE8MSWIN1252

Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points