Business Intelligence – Oracle

Oracle BI EE 10.1.3.3/2 – Calling BI Publisher Java APIs from iBots – Storing reports in File System Using Delivers and BI Publisher Scheduler

Posted by Venkatakrishnan J on February 1, 2008

If you had gone through my previous blog entry here i would have talked about the means of storing BI EE reports on a periodic basis using Java Scripts. But one of the main problems with this is that it would not work in an Unix environment. So, now lets look at an approach to store the BI EE report outputs using Java APIs of BI Publisher and Delivers. But as a pre-requisite you need to go through the above mentioned blog entry to understand how Java Classes are called from BI Delivers. Now in this example, we shall be using BI Publisher Delivery Manager Java APIs and will be calling these APIs from iBots. Lets look at the steps one by one.

1.   The first step to achieve this is to create the Java Class containing the relevant code. I have used JDeveloper 10.1.3.2. In order for the below code to work you need to have 3 jar files included. They are xdocore.jar, versioninfo.jar and schedulerrpccalls.jar. You can find xdocore.jar and versioninfo.jar in {OracleBI}\oc4j_bi\j2ee\home\applications\xmlpserver\xmlpserver\WEB-INF\lib. And you can find schedulerrpccalls.jar in {OracleBI}\web\javahost\lib\scheduler. Now compile the below given code and bundle it as a jar file. To know how to bundle it as a jar check the blog entry mentioned above. Remember, while deploying it as a jar you need to include the above mentioned 3 dependency jars too.

package bieesoap;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import oracle.apps.xdo.delivery.DeliveryException;
import oracle.apps.xdo.delivery.DeliveryManager;
import oracle.apps.xdo.delivery.DeliveryPropertyDefinitions;
import oracle.apps.xdo.delivery.DeliveryRequest;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJavaExtension;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobException;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobInfo;

import java.io.File;

import oracle.apps.xdo.delivery.local.LocalPropertyDefinitions;

public class LocalCopy implements SchedulerJavaExtension{
public LocalCopy() {
}

public void run(SchedulerJobInfo jobInfo) throws SchedulerJobException {
try
{
FileInputStream fileInputStr = new FileInputStream(jobInfo.getResultSetFile());
DeliveryManager delMan = new DeliveryManager();
DeliveryRequest delReq = delMan.createRequest(DeliveryManager.TYPE_LOCAL);
delReq.addProperty(LocalPropertyDefinitions.LOCAL_DESTINATION, “D:\\BIPAPI\\Output.pdf”);
delReq.setDocument(fileInputStr);
delReq.submit();
delReq.close();
}
catch(Exception ex)
{
throw new SchedulerJobException(1, 1, ex.getMessage());
}

}

public void cancel() {
}

}

This is how the above code works. When we include a Java Class from an ibot, the ibot uses the Java Host service to make a remote procedure call to the Run method of the class specified. jobInfo object would get the output of the ibot (say a PDF file) and will pass it on to the Delivery manager API of BI Publisher. The delivery manager API then makes a call to the file system to store the PDF file to a local directory.

      

      

2.   Copy the deployed jar file to your java host lib path(check the above blog entry to know where to specify this path).

3.   Now create an ibot and include any report content. Ensure that you are making the output type to be of PDF since we are making the above output file name to be output.pdf. Go to the Advanced properties and add a Java Class as shown below.

      

      

      

      

      

This can be very useful for advanced integration scenarios. You can even call the BI Publisher FOProcessor API to actually create the BIP reports and can use Delivers to deliver them. There are lots of different functionalities where this can be very helpful.

About these ads

17 Responses to “Oracle BI EE 10.1.3.3/2 – Calling BI Publisher Java APIs from iBots – Storing reports in File System Using Delivers and BI Publisher Scheduler”

  1. Tim said

    Great post Venkat, shows some real value for the WSs.Thanks, Tim

  2. Sumant Sarkar said

    valuable post again.

    Could you post on BI Server caching? How to expire them at the end of ETLs ? Is there a way we can give a “refresh” hyperlink beside the reports to the user, such that when that link is clicked, the reports is recreated from database tables and not from BI server cache ?

  3. Venkatakrishnan J said

    Thanks Tim.

    @Sumant – You need to use Event Tables for that. Or what you can also do is, have your ETL program call a command line utility called NQCMD. Have parameters sent to this utility via a text file. This utility executes any ODBC related calls. Check my blog entry here which has more details http://oraclebizint.wordpress.com/2007/12/17/oracle-bi-ee-101332-calling-java-scripts-and-java-classes-from-ibots/.

  4. Ramesh said

    Hi Venkat

    I’m getting the below error.. Pls. let me know how to rectify..

    +++ ThreadID: 18e8 : 2008-10-15 10:03:31.634
    java.lang.NoClassDefFoundError: oracle/apps/xdo/delivery/DeliveryManager
    at bieesoap.LocalCopy.run(LocalCopy.java:25)
    at com.siebel.analytics.scheduler.javahostrpccalls.RpcSchedulerJob.processMessageInternal(RpcSchedulerJob.java:75)
    at com.siebel.analytics.javahost.AbstractRpcCall.processMessage(AbstractRpcCall.java:94)
    at com.siebel.analytics.javahost.MessageProcessorImpl.processMessage(MessageProcessorImpl.java:175)
    at com.siebel.analytics.javahost.Listener$Job.run(Listener.java:223)
    at com.siebel.analytics.javahost.standalone.SAJobManagerImpl.threadMain(SAJobManagerImpl.java:205)
    at com.siebel.analytics.javahost.standalone.SAJobManagerImpl$1.run(SAJobManagerImpl.java:153)
    at java.lang.Thread.run(Thread.java:619)

  5. Jorge said

    Hi Venkat

    Excelent post. But I tried to select a “Delivery Content” based in a BI Publisher Report, not a dashboard content… when I press the “Select Content” button the navigation explorer shows Dashboard Folders only… The question is: I need to put a BI Publisher Report “into” a dashboard before call it from a iBot schedule?

    Thanks in advance,

    Jorge.

  6. Jesse said

    I am also getting the error below, was there a solution posted for this problem

    +++ ThreadID: 18e8 : 2008-10-15 10:03:31.634
    java.lang.NoClassDefFoundError: oracle/apps/xdo/delivery/DeliveryManager
    at bieesoap.LocalCopy.run(LocalCopy.java:25)
    at com.siebel.analytics.scheduler.javahostrpccalls.RpcSchedulerJob.processMessageInternal(RpcSchedulerJob.java:75)

  7. Hardi said

    Hi Venkat

    thanks for the Excelent post. But I tried it and it’s work but how can i pass parameter from ibot to the jar file ? (i want to change the location of the file)

    Thanks,

    Hardi

  8. Vijaya Nyayapathi said

    Hi Venkat,

    Thanks for the above post. We recently moved from a Windows environment to Linux, therefore your post was very helpful in setting up the iBots to download PDF files using Java. I have one issue, though. The download work fine if the PDF file size is less than 1 MB. If it is larger than 1 MB the file is not downloaded. But the PDF file gets generated (because I get an email with the PDF attachment). I checked the config file under Javahost and it has the PDF Inputstream set to 20480. I’m not sure what else needs to be changed. I would really appreciate if you could give me some suggestions to resolve this issue.

    Thanks.
    Vijaya

    • shital said

      I am having the exact same problem where files that are larger than 540 MB just die when executing the Javahost custom program. Venkat, Can you provide any insight into this? I heard that Oracle suggested us using Custom Javascript instead of Java to address this issue. Have you heard this fix the problem?

      Thanks
      Shital

  9. Clement said

    Same error as Jesse and Ramesh:
    +++ ThreadID: 1f9c : 2009-06-01 15:22:03.304
    java.lang.NoClassDefFoundError: oracle/apps/xdo/delivery/DeliveryManager

    Anyone can help?

    Thanks in advance,
    Clément

  10. Mike said

    Is there any reason why the Publisher classes are required for this solution? Can the FileInputStream simply be piped to a FileOutputStream (I’m clearly a Java novice)?

  11. Amanda said

    i ma havin gthe same problem as Clement that is
    +++ ThreadID: 1f9c : 2009-06-01 15:22:03.304
    java.lang.NoClassDefFoundError: oracle/apps/xdo/deliveryDeliveryManager

    does anyone know how to resolve this issue?

  12. Amanda said

    i ma having the same problem as Clement that is
    +++ ThreadID: 1f9c : 2009-06-01 15:22:03.304
    java.lang.NoClassDefFoundError: oracle/apps/xdo/deliveryDeliveryManager

    does anyone know how to resolve this issue?

  13. Domas said

    Anyone tried this on linux?

  14. Bill said

    Do you have xdocore.jar defined as an additional library path in the ibot advanced section?

  15. PC said

    Venkat,

    Thanks for the blog which was really informative….i was able to implement it. However we want to get the reportname dynamically instead of hardcoding the report to output.pdf. we would like to have the actual name of the report that is being returned by the ibot. we are not able to find the java method which can get that….appreciate if you can help us provide an insight to this problem…many thanks..PC

  16. Jerry Blair said

    This is close to what I am trying to do but not quite there. Is there any way I can call or schedule an existing BI Publisher report through the APIs. I need to do this to integrate Digital Signature within Oracle EBS. My strategy is to create the report and configure for digital signature. Then call BI Publisher’s scheduler to run the report (this is the only way BI Publisher can apply a Digital Signature). Any insight will be greatly appreciated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 158 other followers

%d bloggers like this: