Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

After Report Trigger in BI Publisher

Received Response
223
Views
6
Comments

Summary

After Report Trigger in BI Publisher

Content

Hi

Oracle Business Intelligence 12.2.1.2.0

I want to capture the 'Report Output Generation' status and perhaps log an error/success in a custom table.
To make sure if the final output file is generated successfully

I don't want to depend on the 'After Data' Trigger as it gets fired even if the final output generation is failed.
For example, if there is an bug in the RTF Template Processing Instructions, But the XML Data got generated and 'After Data' trigger still gets fired.

Something like 'After Report' trigger in Oracle Reports Builder?
How can we achieve this in BI Publisher?

Note: We are using only BI Publisher and it is not an Oracle Apps Environment. So we may not have the capability of submitting Concurrent Requests

I also tried to depend on Bursting Query to call a function, but if there is an error in the RTF Template, Bursting Query is still getting executed

Thanks for any help
Sameer

Answers

  • timdexter
    timdexter Rank 6 - Analytics Lead

    Hi Sameer

    BIP has an after report trigger and a notification capability that you can use:

    Notification: https://docs.oracle.com/middleware/12213/bip/BIPUG/GUID-22F94743-8AB7-43E8-AEE8-3D022AB306B2.htm#BIPUG217

    After Report trigger (HTTP notification)

    https://docs.oracle.com/middleware/12213/bip/BIPAD/GUID-11DB0A6D-5847-46A1-97BA-6216D2257A6F.htm#BIPAD306

    Tim

  • Sameer.Darbha
    Sameer.Darbha Rank 3 - Community Apprentice

    Hi Tim

    I created a Servlet as described in the document and was hoping to read the contents of the Output file

    https://docs.oracle.com/cd/E28271_01/fusionapps.1111/e26385/reporttriggers.htm#BIPDV008

    The code gets compiled after adding some xdo jar files to the project, but when deploying the application to the WebLogic Server I was getting the following Exception on activation

         java.lang.ClassNotFoundException: oracle.as.scheduler.MetadataServiceLocal

    The above error is coming when I add the following code in the Servlet

        try
        {
          Scheduler sch = new SchedulerImpl();
          JobHistoryInfo[] jobs = sch.getJobHistoryInfo(id);
          for (int i = 0; i < jobs.length; i++)
          {
            JobHistoryInfo outinfo = jobs[i];
            FileOutputStream fos = new FileOutputStream(targetDir + id + "." + getFileExtension(outinfo.getDocumentDataContentType()));
            byte[] buf = new byte[256];
            int read = 0;
            InputStream in = outinfo.getDocumentOutput();
           
            int available = in.available();
            pw.write("<br>MyADFServlet - Output File Size : " + available);    
            System.out.println("<br>MyADFServlet - Output File Size : " + available);

            in.close();
            fos.close();
          }
        }
        catch (Exception e)
        {
          e.printStackTrace();
          pw.write("<br>MyADFServlet - Exception : " + e.getMessage());    
          System.out.println("<br>MyADFServlet - Exception : " + e.getMessage());
        }

    I am deploying the application to the WebLogic which is running the BI Publisher Server

    Can you please tell what (libraries ?) might be missing on the WebLogic Server?

    We are running WLS 12.2.1.2 and OBIEE 12.2.1.2

    Thanks and Regards

    Sameer

  • Sameer.Darbha
    Sameer.Darbha Rank 3 - Community Apprentice

    Thanks a lot Tim for your reply

    I tried this and it is working.

    But I have a question based on what I observed.

    I was trying to see if I can catch the 'template' errors in the servlet so I can decide what to do based on the successful generation of the report
    My scenario is that based on the success or failed generation of the actual report output, I may want to do different things.
    When the report is successfully generated, I am getting the 'status' parameter as 'S' - which is fine

    So I tried my other test case to 'fail' the Report output.
    So I changed one of the Processing Instructions in the RTF Template and made sure the template fails (tested from MS Word and BIP Catalog - output does not get generated with the problem template)
    (Data XML gets generated successfully, but that does not guarantee the output generation - so I put a bug in the RTF Template for Testing)
    And I scheduled the Report and set the HTTP Notification

    In this case I was expecting the value of the 'status' in the Servlet Request parameter as 'E'
    But I was still getting 'S'
    When I try to republish the Output from the Job History, it still gives error

    So it looks like the status is the Job Status but not the Report Output generation Status

    One way I could think of is to try to read the contents of the file in the servlet and check if it is generated properly
    I am planning to try this.

    Is there any better way to know if the output generation is successful?

    Thanks
    Sameer

  • Sameer.Darbha
    Sameer.Darbha Rank 3 - Community Apprentice

    I am trying another approach

    After doing some research, I found that there is one Web Service 'Schedule Service'

    http://host:port/xmlpserver/services/v2/ScheduleService?wsdl

    with an operation 'getDocumentData()' which will take the job_id and return the byte[] of the output.

    I am hoping to call this Web Service Operation from the Servlet and check if the actual output is generated properly or not

    And based on that I am hoping to take appropriate action

    Will update after I test this

    Thanks

    Sameer

  • Sameer.Darbha
    Sameer.Darbha Rank 3 - Community Apprentice

    The approach I mentioned above is working for my case

    The Web Service is returning the contents of the file and based on it I can decide what action to take

  • Reghu.Kamal
    Reghu.Kamal Rank 1 - Community Starter

    Hi, 

     

    I have a similar requirement.  

     

    I want to run a report with a parameter as input, then the output should be in RTF template. Do we have any WS for this?  As I want to do it via WS

     

    Regards

    Reghu