ORA-31011: XML parsing failed while calling srw.run_report

ORA-31011: XML parsing failed while calling srw.run_report from database

Below is a sample report calling block I copied from Oracle Forums. There was a mistake in the block which was causing the error ORA-31011: XML parsing failed. The solution is simple. the GATEWAY parameter had a 'question mark' at the end of the link.

If you see the output generated by srw.start_debugging, the URL framing would be listed there:
http://192.168.50.53:7778/reports/rwservlet?&SERVER=rep_dev&report=rep_name&userid=user/pass@sid&destype=file&desformat=pdf&destination=/u01/&distribute=yes

If you notice closely there is a & added before SERVER parameter. This is due to the presence of the ? SRW.ADD_PARAMETER of GATEWAY.

If you remove the ? from the last of link the report will be invoked.

DECLARE
v_paramlist srw_paramlist;
v_jobident srw.job_ident;
v_status srw.status_record; 
BEGIN
srw.start_debugging;
v_paramlist := srw_paramlist(srw_parameter('', ''));
srw.add_parameter(v_paramlist, 'GATEWAY', 'http://192.168.50.53:7778/reports/rwservlet?');
srw.add_parameter(v_paramlist, 'SERVER', 'rep_dev');
srw.add_parameter(v_paramlist, 'REPORT', 'rep_name'); --path to where report is
srw.add_parameter(v_paramlist, 'USERID', 'user/pass@sid');
srw.add_parameter(v_paramlist, 'DESTYPE', 'FILE');
srw.add_parameter(v_paramlist, 'DESFORMAT', 'PDF');
--srw.add_parameter(v_paramlist, 'DESTINATION', '/u01/');--path to where xml file
srw.add_parameter(v_paramlist, 'DESTINATION', '/u01/distribution.xml');--path to where xml file
srw.add_parameter(v_paramlist, 'DISTRIBUTE' , 'YES');
v_jobident := srw.run_report(v_paramlist);
v_status := srw.report_status(v_jobident);
srw.stop_debugging;
END;

No comments :

Post a Comment