Apex_util.get_print_Document not working outside apex environment

I am working on one of the assignment in Apex 4.0.2 .
The requirement is to dynamically generate reports and mail to User using the Scheduler program(Pl/sql) -> dbms_scheduler.
I have used BI publisher to create the template and xml data for the report(Excel) and used Apex_util.get_print_Document
in the scheduler program (which is written outside Apex), but this is not working properly,sends blank report to email.
Please suggest how to set the apex session and use Apex_util.get_print_Document to work properly outside apex env.

Apex (PL/SQL web-enabled) code needs to execute inside an Oracle server session that has been properly and correctly initialised for executing web enabled PL/SQL code.
An example of how to execute such PL/SQL by intialising a proper environment, is shown in {message:id=2251131}.
Note that this will not be able to execute Apex pages (via the flow engine) that are not public - that needs a proper authenticated Apex web session. Which could be a tad complex to emulate in this fashion.

Similar Messages

  • In app purchase is not working in testing environment in sandbox for the past 5 days. Please anyone know about this issue.

    in app purchase is not working in testing environment in sandbox for the past 5 days. Please anyone know about this issue.
    What i did
      1 . Added three products more to the existing in-app
      2 . Tested with sanbox
    i am getting the error "cannot connect to itunes store" with error code "0" when trying to purchase product in sandbox.
    Is sandbox is down?Please help guys..

    Apple's sandbox has been down practically all month. You can check the status here:
    http://sandbox.itunes.apple.com

  • Oracle dbms.set_role does not work in APEX application

    Hi, in our j2ee applications, we use secure application role. Basically, the data source use the app user schema to connect to the database. the app user only has create session privileges. the database logon trigger will copy a set of attribute to the local secure context. (ip address, session user, client id, application name). The applications explicitly invoke the stored procedure sec_mgr.set_role before any DMLs are executed.
    the sec_mgr.set_role will check the local context attribute , authorize the ip, application name, and set an appreciated role to this session based on session user.
    we want to apply the same framework to the APEX application. First, we change the paring schema to the app schema which only has create session privilege. then we put the plsql code in which sec_mgr.set_role is called in the application builder --> shared components ---> edit security attribute ---> Virtual Private Database (VPD).
    however, we got the error ORA-06565: cannot execute SET ROLE from within stored procedure
    the sec_mgr.set_role is defined as invoker's right(AUTHID CURRENT_USER)
    do i missing something in APEX to get it work?
    Thanks

    Please explain it does not work in APEX? Is the application updating tables that have a trigger? APEX does NOT override trigger actions. Is it possible the values your trigger is looking for are NOT available in your APEX application? Can you post the trigger code here for review?
    Thank you,
    Tony Miller
    Webster, TX
    What if you really were stalking a paranoid schizophrenic... Would they know?
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Authentication function not working in APEX but works in pl/sql

    Greetings, Jim here.
    I have written a very simple authentication funtion which uses the dbms_ldap package to authenticate using the userid and password from the login page.
    I've tested this function thru pl/sql and it returns true and false accordingly.
    I've created a custom authentication schema and in the authentication function I have return myfunction;
    The problem is, when called thru APEX, it appears to always return true and lets the login proceed, even if the password is correct. I know its using the function due to the fact that if I enter a bogus function as the authentication function, APEX spits up a message saying so.
    So, I know the function works, but I don't know why it does not work with APEX. Posting function below.
    CREATE OR REPLACE FUNCTION ODBS.CUSTAPEXLOGIN (p_username IN VARCHAR2,p_password IN VARCHAR2)
    RETURN BOOLEAN AS
    retval PLS_INTEGER;
    emp_session DBMS_LDAP.session;
    ldap_host VARCHAR2(256);
    ldap_port VARCHAR2(256);
    ldap_user VARCHAR2(256);
    ldap_passwd VARCHAR2(256);
    ldap_base VARCHAR2(256);
    BEGIN
    ldap_host := 'oraldap';
    ldap_port := '389';
    ldap_user := p_username;
    ldap_passwd := p_password;
    ldap_base := 'cn=users,dc=company,dc=com';
    emp_session := DBMS_LDAP.init(ldap_host,ldap_port);
    retval := DBMS_LDAP.simple_bind_s(emp_session,('cn=' || ldap_user || ',' || ldap_base),ldap_passwd);
    if retval = 0 then
    return true;
    else
    return false;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    begin
    if sqlcode = -31202 then
    return false;
    end if;
    end;
    END;
    /

    Hi Jim,
    Can you clarify this -
    The problem is, when called thru APEX, it appears to always return true and lets the login >proceed, even if the password is correctThat implies you're saying your authentication function ALWAYS returns true? Is that correct? Also 'even if the password is correct' doesn't read correctly to me, did you mean 'even if the password is incorrect'?
    You then say -
    now the function works, but I don't know why it does not work with APEX.So by 'does not work' you mean in APEX it is always returning true therefore allowing you to login regardless of the username/password you use? Is that correct?

  • Switch Theme is not working in apex 4.2.Plz  help me out.........

    Hi.......
    Switching from one theme to another theme is not working in apex 4.2..............
    Thanx in advance

    Hi!
    Same problem.
    Upgraded from 4.1 -> 4.2.
    Change theme from slightly modified Green theme (in mine case 101 is number and original was 11, One level Tabs) to Theme 25 Blue Responsive.
    Login page for instance doesn have "Login Region" for instance (not in LOV). And all pages are softly said strange.
    All have DISPLAY problem described on "http://1.bp.blogspot.com/-GzseTk6Lpes/UHvJkg9GulI/AAAAAAAAHRQ/Wt406GGZADQ/s640/Screen+Shot+2012-10-15+at+10.25.29.png", but without many parts that Dmitri describe.
    Rg
    Damir

  • Select count(*) not working in Apex

    Hello,
    The following sql works in both SQL*Plus and Toad but not in apex.  The variable seems always to be 0 no matter what data I have on the table.
    Basically I try to flip the status from "Inactive" to "Active" only when there is no "Inactive" status left on the table.  Say there are 2 inactive statuses.
    If I delete one inactive status, the overall status should still be "Inactive".  However, with this code, it flips to "Active" status regardless. 
    I tried manually assign the variable to 1 and the status was not flipped.  Therefore, it sounds to me that the count(*) is not working in APEX.
    Does anyone experience this before? 
    Thanks in advance,
    Ning
    ===================================
    DECLARE
    v_status_count NUMBER;
    BEGIN
    UPDATE LGR_APP_STATUSES
    SET DELETED = 'Y'
    WHERE LGR_APP_STATUS_ID = :P42_LGR_APP_STATUS_ID;
    commit;
    select count(LGR_STATUS_ID) into v_status_count from LGR_APP_STATUSES
    where DELETED = 'N'
    and LGR_APPLICATION_ID = :p42_application_id
    and LGR_STATUS_ID in (3,8);
    IF (v_status_count = 0) THEN
    update lgr_applications
      set lgr_application_status = 'ACTIVE'
      where LGR_APPLICATION_ID = :P42_LGR_APPLICATION_ID;
    commit;
    END IF;
    END;

    Hi,
    In query you have used p42_application_id.
    Other statements use P42_LGR_APP_STATUS_ID
    Do you have that item? What is session state for that?
    Regards,
    Jari

  • Reading message from MQ- works in WSAD (IDE) but does not work outside WSAD

    Read from MQ:
    Same code works within WASD but does not work outside WSAD.

    PDL - thanks for the suggestions - here are the results:
    A button on the form that executes "this.print();" works fine.
    Changing "this" to "event.target" results in the same error.
    document.getElementById("PDFObj").Print(); works fine.
    However, the reason that I'm using ".postMessage([message])" instead of ".Print()" is because I actually have a toolbar that has save, print, zoom in, zoom out, page up, page down, etc.... I simplified the switch statement in the post above to only include print, but in reality has a case for each of the functions above. The postMessage call is triggering the error, since the catch statement is printing out the error message above. Any idea why this would work with Professional but not Reader.

  • Functions (back & stop ) are not working in production environment

    Hi All ...
    Some functions (back and stop) are not working in production environment, where as those functions are working in QA testing environement..please answer.. what could be the reasons for not working some functions
    in production environement.
    Regards,,
    Krishna

    Hi,
    Based on the error message, it is related to the item in your production environment, then the workflow will occur exception.
    As your workflow worked perfectly in your other environments, I suggest you can check if some item has is valid in the document library.
    You can try to use Fiddler to track the web request and find in which item the workflow occurs exception.
    Here are some detailed articles for your reference:
    https://msdn.microsoft.com/en-us/library/vstudio/ee231573(v=vs.100).aspx
    http://www.andrewconnell.com/blog/SP2013-Workflow-Advanced-Workflow-Debugging-with-Fiddler
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • DbControl not working in clustered environment

    Hi all,
    I have a situation here with Oracle dbcontrol -it is not working in clustered environment. It is working on one node but fails on other node. Any suggestions ?
    Thanks in advance !

    http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/emca.htm
    in this article Oracle has given example with RAC. so thats why i asked that question.Exactly, with RAC. If you specify -cluster option, you should have a running cluster, isn't it ?

  • Interactive Reports not working with APEX listener

    Hi,
    I have posted this question APEX listener forum couple of weeks ago but very few responses.
    If any one from here can help then it would be great.
    Interactive Reports not working with APEX listener
    Best Regards,
    Baig

    Sorry for late response.
    It was a firewall issue

  • Sys_context not working from APEX application / environment

    I am struggling to retrieve a user-defined context value using sys_context(...) from APEX application / environment
    I have created a global context to be used as a storage mechanism for log severity to be recorded.
    CREATE OR REPLACE CONTEXT PA_LOGGER_CTX USING PA_LOGGER ACCESSED GLOBALLY;It is seeded through a function pa_logger.set_severity(1) within the package pa_logger through (excerpt):
      dbms_session.set_context(c_ctx_context_label, c_ctx_severity_label, TO_CHAR(p_severity_in));
      with:
      c_ctx_context_label     CONSTANT NVARCHAR2(16) := 'PA_LOGGER_CTX';
      c_ctx_severity_label    CONSTANT NVARCHAR2(8) := 'SEVERITY';
      p_severity_in   IN  PLS_INTEGERusing the following from sqlplus, other DB-tools, works as expected:
    -- setting it
    BEGIN
      pa_logger.set_severity(2);
    END;
    -- displaying it
    SELECT sys_context('PA_LOGGER_CTX', 'SEVERITY') FROM DUAL;returns 2
    This works from different sessions, different users ... no problem.
    Using it from within an APEX (accessed via embedded gateway/XE11.2 or OHS/11.2.0.2.0 ) application or even from the "SQL Commands" from the APEX Workspace returns a NULL value for :
    SELECT sys_context('PA_LOGGER_CTX', 'SEVERITY') FROM DUAL;And
       SELECT value  FROM GLOBAL_CONTEXT WHERE NAMESPACE='PA_LOGGER_CTX' and ATTRIBUTE = 'SEVERITY';returns the right value, which obviously defies the purpose of using the CONTEXT.
    It is as well possible to set the CONTEXT to a different value, which is picked up outside APEX, but even so using sys_context does not work, always returning NULL
    As a note aside: using sys_context with a standard CONTEXT, e.g. SELECT sys_context('USERENV', 'NLS_DATE_FORMAT') from DUAL works without any problems.
    I guess I have a conceptual break somewhere. Does this have to do with the APEX user used, wrapping within the APEX environment, the way the context is defined ....
    Any help is appreciated.
    Many thanks,
    - Thomas

    Hi Rod,
    Thanks for the time to answer. Meanwhile I found some more hints on the subject (Retrieve values from my own global context in Apex and I do now understand the concept.
    I understand that I can even clear the specific CLIENT_IDENTIFIER by issuing a "dbms_session.clear_identifier()", which then subsequently works
    Looking at the CLIENT_IDENTIFIER as set by APEX it is "<apex_login_user><apex_session>";
    I understand it is set for every DISPLAY-SUBMIT it is reset by the APEX framework.
    Hence it is not sufficient to set it for a user session; it needs to be changed for every display-submit. I can achieve this through application processes, but I am really reluctant to do so, because I do not know, if APEX relies on the CLIENT_IDENTIFIER to be set the way it is done. I suspect a purpose behind this, causing me problems elsewhere. I post this as a seprate question as this question has been answered.
    On to your point about: Using a table variable. This is the way it works currently, but allegedly using the CONTEXT would give us for the logging configuration a performance gain of about 1 dimension..... but unfortunately other problems..
    Thanks!
    - Thomas

  • APEX_UTIL.GET_PRINT_DOCUMENT  not returning anything

    I have a report query and have provided a layout to print it
    I need to get the html generated from the report so that I can mail it.
    As I could not get the generated file in the PL/SQL package written , for quick testing I started testing using a SQL stmt to check for the length of the LOB
    select dbms_lob.getlength(APEX_UTIL.GET_PRINT_DOCUMENT (
    p_application_id=>my_app_id,
    p_report_query_name=>'name of qry',
    p_report_layout_name=>'name of layout',
    p_report_layout_type=>'rtf',
    p_document_format=>'htm')) lob_size
    from dual
    I also tried by providing the p_print_server => null in addition to the parameters passed.
    But the query returns NULL only.
    The qry and layout are correct as the query when tested in the edit qry screen in APEX shows the output report in the format required (including html , PDF etc)
    Any pointers ?
    Thx
    Edited by: user618186 on Apr 24, 2009 2:35 PM
    Edited by: user618186 on Apr 24, 2009 2:36 PM

    I have the same problem exactly...works as an APEX proc, will not work from sqlplus despite setting security group id. Mail works. Attachments with another BLOB works. But I can't get this function to give me the BLOB.

  • Apex_util.get_print_document not generating correct output

    hello,
    Basically what I've done is this.
    1) stored a very simple xml file in a clob field called xml_file_clob in a table called xml_test1
    2) stored an rtf file in a clob field called rtf_layout in a table called xml_test1
    3) created a procedure (below) called generate_report_as_blob which attempts to combine the xml and layout and generate a PDF from it which is stored into a blob field in the same table where 1) and 2) are above .....
    4) I have confirmed that taking the clobs in 1) and 2) from the table above and creating xml and rtf files on my desktop that I can open the rtf file in Word, load the xml file and preview it and it does render the pdf as intended (so I think my clobs in the table are good)
    5) run the procedure below. It compiles and runs with no errors but generates a file into the blob column that when downloaded to my desktop looks like the below output (when opening w/ pdf it says there was an error opening the file)
    Any thoughts are greatly appreciated. I feel like I'm really close and am excited about what I could do with this if this can work.
    Thanks in advance, KW
    =========================================================================
    MY PROC
    ============================
    procedure generate_report_as_blob is
    v_xml xmltype;
    rtf_layout clob;
    v_rpt_output blob;
    v_xml_rpt_data clob;
    begin
    select xml_file_clob, rtf_layout_clob
    into v_xml_rpt_data, rtf_layout
    from xml_test1
    where xml_id = 2;
    v_rpt_output :=
    apex_util.get_print_document(p_report_data => v_xml_rpt_data
    ,p_report_layout => rtf_layout
    ,p_report_layout_type => 'rtf'
    ,p_document_format => 'pdf'
    ,p_print_server => null);
    update xml_test1
    set rpt_pdf_output = v_rpt_output
    where xml_id = 2;
    commit;
    end generate_report_as_blob;
    ==========================================================================
    ==========================================================================
    MY OUTPUT (as apdf file) :
    =================
    %PDF-1.4
    1 0 obj
    <<
    /Type /Catalog
    /Pages 3 0 R
    >>
    endobj
    2 0 obj
    <<
    /Type /Info
    /Producer (Oracle BI Publisher 10.1.3.4.0)
    >>
    endobj
    3 0 obj
    <<
    /Type /Pages
    /Kids [
    /Count 0
    >>
    endobj
    4 0 obj
    <<
    /ProcSet [ /PDF /Text ]
    >>
    endobj
    xref
    0 5
    0000000000 65535 f
    0000000010 00000 n
    0000000065 00000 n
    0000000147 00000 n
    0000000208 00000 n
    trailer
    <<
    /Size 5
    /Root 1 0 R
    /Info 2 0 R
    /ID [<fdd8d0c54769561cc797a7c9d0ae42cd><fdd8d0c54769561cc797a7c9d0ae42cd>]
    >>
    startxref
    258
    %%EOF
    ====================================
    Edited by: Ken Wood on Oct 30, 2009 8:56 AM

    I have the same problem exactly...works as an APEX proc, will not work from sqlplus despite setting security group id. Mail works. Attachments with another BLOB works. But I can't get this function to give me the BLOB.

  • Rtf Templates created with BI Publisher 11.1.1.3.0 not working in APEX

    I created templates using BI Publisher v10 Desktop that I used to create Report Layouts in APEX and everything worked just fine. However, I've upgraded to BIP 11.1.1.3.0 Desktop and the rtf templates don't work. I suspect that the problem is with the graphs.
    Is there something in my APEX environment that needs to be upgraded or modified to be compatible with the BIP v11 templates? Are templates created with BIP v11 compatible with APEX Reporting?

    I'm having a similar issue with 11.1.1.3.0
    My RTF templated uploaded to APEX correctly, and seems to load and generate ok. The OUTSIDE formatting on the report (title, etc) all seem to show fine, but the actual repeating data block doesn't show any of the data or columns or boxes..... Just the column headers.
    VERY FRUSTRATING......

  • Security Issue httpOnlyCookies="true" is not working with production environment

    Dear All, 
    I have tired to make set cookie value as httpOnly
    The development environment is working fine and give me an output like that 
    Set-Cookie
    WSS_KeepSessionAuthenticated={3644d93c-d1d3-46cd-845f-42c01640ab21};
    path=/;
    HttpOnly
    But when implement the same changes in web.config production environment its not working 
    Set-Cookie                NLSessionCdomainweb=a98q9jnsy0vXk5+RHeHnlKmM+HnneA9KmhIAR6g1bJiwTs8sD6d7dfV1gBffc8HiJXBowxdO8LhZAiIEKiFY6PzNWySyRs5rvgCfPu8XIFnqKcN4XQ4UL9PN3JI3f4E6;path=/;domain=.domain.com
    I am using sharepoint 2010, under web.config i made the following changes  
    Add following tags under system.web
    <httpRuntime maxRequestLength="2097151" enableVersionHeader="false"
    />
    <httpCookies httpOnlyCookies="true"/>
    Add following tags under <system.webServer>
      <httpProtocol>
          <customHeaders>
                   <remove name="X-Powered-By" />
                 <remove name="MicrosoftSharePointTeamServices" />
          </customHeaders>
        </httpProtocol>
    Can any one tell me why it's happening i have checked all possible reasons from my side but no success  
    Regards 
    Rashid Bilgrami 
    RB

    Hi,
    From your description, I know you want to set cookie value as httpOnly but it is not work.
    Please try to add codes below to your global.asax file:
    <SCRIPT language="C#" runat="server">
    protected void Session_Start(Object sender, EventArgs e)
     try
      if (Request.IsSecureConnection == true)
                    Response.Cookies ["ASP.NET_SessionId"].Secure = true;
     catch (Exception)
    </SCRIPT>
    Please refer to this article:
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/0fe55c13-3911-422e-af17-cb5c1ab2abd7/missing-secure-httponly-flags-on-sharepoint-2010-cookie?forum=sharepointadminprevious.
    Best Regards
    Vincent Han
    TechNet Community Support

Maybe you are looking for

  • Implementing hierarchy in a dimension using OMBPLUS script

    Hi all, I am trying to create a dimension with two levels using TCL scripts. The first level is 'CHIP' which roll up to 'TOTAL'. I'd like to know how I can implement the hierarchy between the two levels. It would be great if any of you can help me wi

  • Ios 5 problems

    ios 5 iphone4 Macbook pro- Every time I try to sync my iphone itunes crashes when adding photos.  This has happened more than 50 times.  Here is the error report I get.  Any help would be appreciated.  Process:         iTunes [4844] Path:           

  • Creating Apple TV movs in iTunes

    I have a few movies in iTunes which won't sync with my Apple TV. So I right click on them and "convert for Apple TV".. it spends about an hour converting each file. But once finished I am left with a mov that is the correct run time and correct audio

  • Multi page jpg

    We received a jpg file that seems to gave 2 pages when you view it in Bridge. When we open the file in Photoshop or link it in Indesign or Illustrator we only see the 1st page or view of the file. I was very surprised to see this in Bridge, as far as

  • RH7 increases TOC font size for Mac browsers

    I'm using RoboHelp 7. I'm running into several bugs with my generated help. It seems whutils.js (found in the !SSL! folder), adds 4 pts to the font displayed on a Macintosh. My lovely 10 pt TOC displays accurately on my PC using Firefox and IE. But o