A question about error with jasperserver for pdf and Apex

I have created a pdf report on jasperserver and I can call it from apex via a url and it displays fine. The url is this format {http://server:port/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/Apex/deptemp&output=pdf&deptNo=#DEPTNO#&j_username=un&j_password=pw}
However, I am trying to follow a stored procedure executed from Apex so it would not expose the username/pwd in the url like above.
If I am reading the apache error log correctly it is erroring in this piece of the code below where it executes {Dbms_Lob.writeAppend}
loop
begin
-- read the next chunk of binary data
Utl_Http.read_raw(vResponse, vData);
-- append it to our blob for the pdf file
Dbms_Lob.writeAppend
( lob_loc => vBlobRef
, amount => Utl_Raw.length(vData)
, buffer => vData
exception when utl_http.end_of_body then
exit; -- exit loop
end;
end loop;
Utl_Http.end_response(vResponse);}
The error log says this; HTTP-500 ORA-14453: attempt to use a LOB of a temporary table, whose data has alreadybeen purged\n
What is this error telling me and how can I correct it?
The stored procedure I am following is below but replaced the vReportURL with my url like above that works.
Thank you,
Mark
{CREATE OR REPLACE procedure runJasperReport(i_deptno   in varchar2)
is
vReportURL       varchar2(255);
vBlobRef         blob;
vRequest         Utl_Http.req;
vResponse        Utl_Http.resp;
vData            raw(32767);
begin
-- build URL to call the report
vReportURL := 'http://host:port/jasperserver/flow.html?_flowId=viewReportFlow'||
     '&reportUnit=/reports/Apex/deptemp'||
     '&output=pdf'||
     '&j_username=un&j_password=pw'||
     '&deptNo='||i_deptno;
-- get the blob reference
insert into demo_pdf (pdf_report)
values( empty_blob() )
returning pdf_report into vBlobRef;
-- Get the pdf file from JasperServer by simulating a report call from the browser
vRequest := Utl_Http.begin_request(vReportUrl);
Utl_Http.set_header(vRequest, 'User-Agent', 'Mozilla/4.0');
vResponse := Utl_Http.get_response(vRequest);
loop
begin
-- read the next chunk of binary data
Utl_Http.read_raw(vResponse, vData);
-- append it to our blob for the pdf file
Dbms_Lob.writeAppend
( lob_loc => vBlobRef
, amount  => Utl_Raw.length(vData)
, buffer  => vData
exception when utl_http.end_of_body then
exit; -- exit loop
end;
end loop;
Utl_Http.end_response(vResponse);
owa_util.mime_header('application/pdf',false);
htp.p('Content-length: ' || dbms_lob.getlength(vBlobRef));
owa_util.http_header_close;
wpg_docload.download_file(vBlobRef);
end runJasperReport;
/}

I am new to working with working with jasperserver to apex interfacing, and also using utl_http with binary data.
But I guess typing my question down helped me figure out a way to make it work for me.
I combined info from http://www.oracle-base.com/articles/misc/RetrievingHTMLandBinariesIntoTablesOverHTTP.php
and from http://sqlcur.blogspot.com/2009_02_01_archive.html
to come up with this procedure.
{create or replace PROCEDURE download_file (p_url  IN  VARCHAR2) AS
  l_http_request   UTL_HTTP.req;
  l_http_response  UTL_HTTP.resp;
  l_blob           BLOB;
  l_raw            RAW(32767);
BEGIN
  -- Initialize the BLOB.
  DBMS_LOB.createtemporary(l_blob, FALSE);
  -- Make a HTTP request, like a browser had called it, and get the response
  l_http_request  := UTL_HTTP.begin_request(p_url);
  Utl_Http.set_header(l_http_request, 'User-Agent', 'Mozilla/4.0');
  l_http_response := UTL_HTTP.get_response(l_http_request);
  -- Copy the response into the BLOB.
  BEGIN
    LOOP
      UTL_HTTP.read_raw(l_http_response, l_raw, 32767);
      DBMS_LOB.writeappend (l_blob, UTL_RAW.length(l_raw), l_raw);
    END LOOP;
  EXCEPTION
    WHEN UTL_HTTP.end_of_body THEN
      UTL_HTTP.end_response(l_http_response);
  END;
-- make it display in apex
owa_util.mime_header('application/pdf',false);
htp.p('Content-length: ' || dbms_lob.getlength(l_blob));
owa_util.http_header_close;
wpg_docload.download_file(l_blob);
  -- Release the resources associated with the temporary LOB.
DBMS_LOB.freetemporary(l_blob);
EXCEPTION
  WHEN OTHERS THEN
    UTL_HTTP.end_response(l_http_response);
    DBMS_LOB.freetemporary(l_blob);
    RAISE;
END download_file; }
Don;t know what I did wrong, but I could not create an 'on-demand' process to call my procedure. I did not understand what it means when it says 'To create an on-demand page process, at least one application level process must be created with the type 'ON-DEMAND'.
so I had to use a blank page with a call to my procedure in the onload - before header process and that seems to work ok.
Thank you,
Mark

Similar Messages

  • Question about purchasing apple products for government and militairy personel

    Hi everybody,
    Forgive me if this isn't the right place to start this thread and for my not perfect English language skills :$
    My name is Nick and I live in The Netherlands near Amsterdam.
    In February i'm traveling to NYC for a 7-day citytrip.
    On the internet i read some things about many discounts for militairy personel, including stories from my fellow Dutch soldiers who also got this discount because The Netherlands are allies with the US within the NATO missions in Afghanistan, Iraq and so on.
    I am an active soldier in the Dutch Army.
    In The Netherlands all Apple products are more expensive then the US products ( because of the Dutch taxes ).
    So you understand why i want to buy the Iphone 4S and Ipad 2 in the US.
    Now my question is, can I also get the militairy discount from Apple because I am a NATO allied soldier?
    Or does this rule only apply on US soldiers?
    I hope some one can help me with this issue, because I don't get enough salary to buy Apple products in The Netherlands.
    Thanks in advance,
    with kind regards,
    Nick

    Also realize that the prices in many countries appear higher than US prices because they include taxes. Because sales taxes are different in each state & town/city in the US, the price listed on the website for an iPad is less than what you'd actually be paying - and New York City taxes are not cheap (combined state and city is 8.875%) - so a $499 iPad actually costs $543.29. You might have to pay an import duty when you bring the iPad back, and if you don't you could be charged for it when bringing the iPad into an Apple Store for warranty service - I've been told this is true in the UK, for one.

  • Question about function with in parameters

    Hello,
    I have a question about functions with in-parameters. In the HR schema, I need to get the minimum salary of the job_id that is mentioned as an in-parameter.
    this is what I am thinking but I dont know if it's correct or not or what should I do next!
    create or replace function get_minimum_salary (i_job_id in varchar2)
    return number
    as
    begin
    SELECT min_salary INTO min_sal
    FROM jobs
    where job_id = get_minimum_salary(xy);
    RETURN i_job_id;
    end get_minimum_salary;
    thanks in advance
    EDIT
    Thanks for your help all.
    Is it possible to add that if the i_job_id which is the in type parameter does not have a minimum salary then use the following function to register an error:
    create or replace procedure insert_error (i_error_code in number,
                                                      i_error_message in varchar2)
    as
    begin
    insert into error_table (error_user, error_date, error_code, error_message)
    values (user,sysdate,i_error_code,i_error_message);
    end insert_error;
    This function is basically to say that an error has occured and to register that error, at the same time I need to print out the error using the dbms_out.put_line.
    Any ideas of how to do that?
    Thanks again
    Edited by: Latvian83 on Jun 1, 2011 5:14 AM

    HI
    I have made little bit changes in ur code. try this
    create or replace function get_minimum_salary (i_job_id in varchar2)
    return number
    as
    v_Min_sal jobs.salary%type=0;---- Variable declaration
    begin
    SELECT min_salary INTO v_ min_sal
    FROM jobs
    where job_id = i_job_id;
    RETURN v_Min_sal;
    end get_minimum_salary;
    Regards
    Srikkanth.M

  • Question about lead in music for podcasting.

    Question about lead in music for podcasting.
    I listen to many other podcasts and there are those which play lead in music with bit of music inside their podcast. The music are songs we all know and enjoy. I have notice that they only play short small clips of these songs and are not royalty free songs.
    My Question would be is there a limit of time which you can play any song with out paying for it and use it in a podcast legally.
    Thanks Mike

    Legally you cannot use copyright music without written permission or a licence from a recognized authority, no matter how short the clip. Many people do this and get away with it (and for full tracks too) and it's debatable how much notice anyone is likely to take, or whether they would be bothered about a short clip. But the legal position is, it's not legal.

  • The "Open With" menu for PDF files has 19 apps listed to choose from.

    How do I modify the drop down menu for "Open With" to eliminate about 15 apps suggested for PDF files?

    I want to permanently shorten the list down to only a few apps to select from.

  • Question about Communication with Oracle 7

    Hi,
    Generally we use Oracle Snapshots for Communication, but since Oracle 9.2.0.5 do not work with Oracle 7.1.5.2.4. we are thinking about do use Oracle Interconnect for this Link.
    Now I have the following two Questions about Communication with Oracle 7:
    1. Is an Adapter for Oracle 7.1.5.2.4 available?
    2. From your experience, does it make sense to install Oracle Interconnect for implementation of only one read only Link with 3 Tables if an OAS for BI is available?
    Thanks,
    Hannes

    1. The Oracle database adapter is for Oracle 8i and up. I checked the code needed in the database and doubt that will work in Oracle 7.
    1. The other option Advanced Queuing also needs 8i and up.
    2. For me it doesnt make sense that you want to connect to Oracle 7. Oracle 7 is unsupported and should not have to be developed against. Also the license costs for Oracle Interconnect ~17K without any discount is a bit steep for read only links to three tables. Having the OAS means you wont have to pay another additional ~17K for the apps server.

  • Question about the Filter type for the trace provide "Microsoft-Windows-Kernel-File"

    Hello all,
    I have moved this question from the Windows
    Server General Forum accorfing to the suggestion from Mr. Justin Gu 
    I have a question about the Filter function for the trace provider "Microsoft-Windows-Kernel-File".
    I can find the Filter function with the following operation.
    Mr. Justin Gu wrote:
    > You create a Data Collector Set for the trace provider "Microsoft-Windows-Kernel-File" and finish completely, then you > can right click it and select Properties.
    In the Properties dialog box, click Filter and
    then select ‘Edit…’. You will be> able
    to see the Filter type and Filter data in the Filter dialog box.
    What
    Kind of Filter can
    I use in this Filter dialog box?
    And, how can I set to exclude the some kind of datas?
    Could you give me your suggestion?
    Thank you.

    What
    Kind of Filter can
    I use in this Filter dialog box?
    And, how can I set to exclude the some kind of datas?
    Could you give me your suggestion?
    Thank you.
    I'm looking for the same information.

  • Performance, minimum bandwidth, thumbnail previews for PDF and InDesign Files with web content viewer

    Hi,
    We are considering using DPS with a web content viewer for large PDFs and/or InDesign files. The client using a web viewer might have very limited bandwidth (some as low as 256Kbps). We ask:
    1 - How well does the web viewer perform with very large PDFs and InDesign files  (500 MB+) with limited bandwidth? Does the file stream in chunks and the PDF shows as soon as the first page or two are available, with the rest loading in the background, or does the entire file come down in one part and then shown?
    2 - Can PDF and InDesign files support thumbnail previews? For example, one image per PDF page and user can scroll forward and back.
    Your thoughts and comments are greatly appreciated.
    Thanks!
    -Stephen

    Hi Stephen,
    The way the web viewer works is that it converts the PDF/InDesign files to PNGs along with additional HTML assets. Assets are downloaded as they’re ready for a given page (e.g. first, page 1 is filled with its assets as they become available, then page 2, etc), so a reader wouldn’t need to wait for the entire article to load. The next few pages are also loaded in the background, so the reader wouldn’t be likely to notice lag as they flipped through pages to the next page after reading the current one. So the lag will depend on the size of an individual page.
    For your question around thumbnails, the web viewer does not load a preview image so the reader would need to wait for the assets I described above to load.
    Hope this helps...
    Brian

  • Free Solution for PDF in APEX

    PL_FPDF ( ver )
    PDFBLOB ( ver )
    anyone use these tools?
    have documentation?
    what is your opinion?
    there is something better?
    Edited by: e:// on 16/07/2010 16:29

    hello,
    I already applied configurations for JasperReports and Apex integration but I still encountered errors... I can't view the sample pdf evertym I open it.
    Can you help me with this one?
    thanks...
    Muffinboy

  • I just got tOhe iPhone 4Gs today and had contacts and photos uploaded from another phone synced new phone with iTunes for music and accidentally restored it so all my old iPhone stuff is on the new one is there any way to fix this

    I just got tOhe iPhone 4Gs today and had contacts and photos uploaded from another phone synced new phone with iTunes for music and accidentally restored it so all my old iPhone stuff is on the new one is there any way to fix this ?! Please help !!!!

    Could you be more specific about what exactly do you want to fix now?

  • Airport Utility `install failed' error with both 6.0 and 6.1

    Hi folks
    I am running Mac OS X Lion 10.7.4 (11E53) and cannot get the Airport Utility to run at all. [5.5.3] The application icon flickers as though it is about to launch and then nothing happens.
    I have tried other 5.x downloads and they all fail because I am running OS X Lion 10.7.4.
    Doing a standard Software Update or using a download of 6.x from the Apple Support site, the installer comes up with an `install failed' error with both 6.0 and 6.1, having gotten through the complete process and looking like they were `successful'.
    It's the only time in two years and many updates later that i have come across this issue, so I am unsure how to start to tackle it.
    Any ideas or suggestions please?
    Thanks in advance.

    Welcome to Apple Communities
    Backup your files and try this:
    1. Reboot from recovery partition (or as in my case USB recovery drive)
    2. Select Re-install Mac OS X
    3. Allow the process to run through multiple restarts
    4. When reinstall process is complete run software update (side note, my software update would not launch as long as my USB recovery stick was plugged in, weird)
    5. Run all updates saving the Airport Utility 6.0 until last.
    6. Install the airport utility from software update.

  • Bridge does not show dimensions for .PDF and .AI files

    Is there any way to see the dimensions in cm (or inch) for PDF and AI files in Bridge? I'm using Bridge CS5 4.1.0.54 as part of CS5.5 Design Premium, have set the preferences in Bridge to show them, but there are no values in the metadata fields for dimensions in inch/cm. I don't know if this behaviour is normal or if there's something wrong with my installation...
    TIA,
    Matthias

    May be 'dimension' is not the right word/translation. In my german version it says 'Abmessungen (in Zoll)' or 'Abmessungen (in cm)', which should mean something like 'dimension' or 'size'. DIN A4, A5, US Letter, Legal etc. pp. in cm or inch.

  • Error with Title i.d. and password in app builder

    Hi;
    Ive just subcribed to Pro edition DPS and am starting to build my viewer app, however im getting an error with Title i.d. and password in app builder
    It says niether the title id or password are valid, however they are the same as i've used to both log into app builder and to upload my folios to the folio producer.
    What am i missing here?
    Scott

    Yes, the account administration stuff is confusing when you jump from a "creative" account to a Pro account. As the Getting Started guide states, when you set up your Pro account, you should use dedicated Adobe IDs, such as [email protected] and [email protected], not [email protected] The Copy Folio command makes it easy to transfer folios from one account to another, especially if you do it on the same machine you used to create the folios. Everything moves over nicely.
    Again, don't use your "master" account for creating and publishing folios. Use it only for account administration.

  • Japanese/C​hinese Font for PDF and MS Office files

    Hi,
    I have both the BB9860 and the Playbook, always uses the Playbook to download and read email attachments.
    However, I realise that for  PDF and MS Office files, japanese/Chinese fonts are not supported.
    Is there any way for me to download the add-ons and install into my playbook?
    Thanks.
    Regards, Song Por

    PDF can display chinese, MS Word cannot display chinese.

  • TS2446 I forgot the security question about what was my first car and what is my favorite car! What is the solution to change that? please help me, thank you in advance Leo

    I forgot the security question about what was my first car and what is my favorite car! What is the solution to change that? please help me, thank you in advance Leo

    If you have a rescue email address set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address set up then go to Express Lane  and select 'iTunes' from the list of 'products' in the middle of the screen.
    Then select 'iTunes Store', and on the next screen select 'Account Management'
    Next choose 'iTunes Store Account Questions' or 'iTunes Store account security' (it appears to vary by country) and fill in that you'd like your security questions/answers reset.
    You should get an email reply within about 24 hours (and check your Spam folder as well as your Inbox)

Maybe you are looking for

  • PO message status should change to PROCESSED

    hi   we are taking PO print from ME22N(before releasing it ),  here first we set message then  Goto-->Print Priview-- >Print but problem is that status of Message is not getting changed to processed as it happens in ME9F. how i can get it , we want i

  • To avoid putting a field in group by clause

    hi all i have the following query with me SELECT   SUM (  (NVL (f.calc_cement_sk, f.calc_amount) * NVL (f.item_price, 0)               - (  NVL (f.calc_cement_sk, f.calc_amount)                  * NVL (f.item_price, 0)                  * (NVL (f.dis_

  • In Process and Out of Process Report Server

    Hi All I am developing application using oracle 9i Forms and that will we will implement on Clustering Structure and expected more that two thousand users. There is In-Process and Out of process Server. For out of Process i have to Use RUN_REPORT_OBJ

  • Mapping of Source System Names

    Hello, Has some body done the mapping of Source System for <b>"Transport"</b> to go through which is done using the following steps: RSA1 --> Tools --> Mapping of Source System Names(Conversion of source system name after transport) You have to enter

  • Decimal Notation settings

    Dear Community, I would like to know if is it possible use on SAP  the " . " key of the numeric keyboard as a " , " symbol like we use on MS Excel by regional settings done on Control Panel of windows OS. In excel If I press the " . " on numeric keyb