X

An Oracle blog about BI Publisher

Getting started with BIP APIs

Had a request today asking how to get started with the BIP API layer. I think the use of the APIs is straightforward enough, there are lots of examples to get you started in the developer sections of the user guide. The tough bit is, what libraries and jars need to be in the class path to be able to work with the APIs without annoying compile errors? So heres the list:




  • xdocore.jar  - the core BIP/XMLP library

  • aolj.jar - this is an Oracle EBS library, we need it whether you're developing in EBS or not

  • i18nAPI_v3.jar - this is the i18n library used for localization functions

  • xdoparser.jar  - this is the scalable XML parser and XSLT 2.0 engine

  • xmlparserv2-904.jar  - the main XML parser/XSLT engine - these will come together again in a coming version.

  • bipres.jar - charting library

  • bicmn.jar - charting library

  • jewt.jar - charting support library

  • share.jar - charting support library

  • collections.jar - you only need this if you are working with the delivery APIs or bursting engine.


Now if you're using JDeveloper then the charting and XML Parser libraries will already be available to you. I'd recommend creating a directory with all of the above thou and using them as custom libraries in your project. That way you'll know when it comes to deployment you're not going to get any unexpected surprises at runtime.

Where to get the libraries:
1. EBS - you can point your java project to the JAVA_TOP directory  - not the simplest solution
2. Download the BIP Server and open the EAR file and find the jars
3. Download the Template Builder for Word, install and check the jlib library under the install directory.



So now you know what you need and where to get it.



Need a quick start ... how about applying an RTF template to some XML and generating PDF output ...

package xdotestbed;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.template.FOProcessor;
import oracle.apps.xdo.template.RTFProcessor;

public class XDOTest
{
  public XDOTest()
  {
  // Need to use a try-catch block
  try
  {
    // Set the RTF template
    FileInputStream fiS = new FileInputStream("c:\\temp\\check.rtf");
    //Instntiate the RTFProcessor
    RTFProcessor rtfP = new RTFProcessor(fiS);
    // Set the output XSL
    rtfP.setOutput("c:\\temp\\check.xsl");
    // Process
    rtfP.process();
  }
  catch (FileNotFoundException ex)
  {
    ex.printStackTrace();
   }
  catch (IOException ex)
  {
    ex.printStackTrace();
   }
  catch (XDOException ex)
  {
  ex.printStackTrace(); 
   }
  
   //Now process the XSLFO template against the XML data
      // Instantiate the FOprocessor
      FOProcessor processor = new FOProcessor();
      // set XML input file
      processor.setData("c:\\temp\\check_data.xml");
      // set XSL input file
      processor.setTemplate("c:\\temp\\check.xsl");
      // set the output format
      processor.setOutputFormat(FOProcessor.FORMAT_PDF);
      //set output file
      processor.setOutput("c:\\temp\\check.pdf");
    // Now we process, have to surround with a try-catch block thou
    try
    {
      // Process !
      processor.generate();
    }
    catch (XDOException e)
    {
      e.printStackTrace();
    }

  }

   // Heres the main method to run the class.
// You could of course add arguments for the RTF, XML

// and output PDF and avoid hard coding them in the class.
// Sorry, Im being lazeeee ...

public static void main(String[] args) {
        XDOTest xDOTest = new XDOTest();
    }
}





Not too tough right ? With a little effort you can get the whole thing streaming rather than writing to disc, bolt on a call to the Data Template engine to fetch the data, use the FormProcessor to stick multiple outputs together ... the list goes on.

Join the discussion

Comments ( 4 )
  • Udaya Wednesday, September 2, 2015

    Hi,

    In our product we use FOProcessor to generate the HTML report using XSL. If the report contains multiple pages then it contains Page number, page header and page footer. That is all good.

    However, the HTML page generated contain multiple HTML header and HTML footer. That is for each page there is separate <html> , <head> <style> , <body> tags. Is there a way to limit only on HTML header and HTML footer for the whole page.


  • Tim Wednesday, September 2, 2015

    There is a setting you can pass as a property object to the FOProcessor to turn this off.

    http://docs.oracle.com/cd/E17904_01/bi.1111/e13881/T518230T522345.htm#T562200

    check the API docs to see how to set and pass the property object

    Cheers

    Tim


  • guest Thursday, December 22, 2016

    I am working on an enhancement where in existing J2EE application is making use of BI publisher JAVA API to generate reports. Current application is integrated with old BI version and we have upgraded BI to 11g.

    So we have replaced xdo.jar from latest BI version due to which we are getting error in our java code which is referencing to DataProcessor class as this class is not present in latest xdo.jar.

    FYI..The Data Engine API creates an XML document from database data. The DataProcessor class is used to generate an XML document from a data template.

    So could you help me what can be used to achieve the same in 11g.


  • Tim Thursday, December 22, 2016

    Hi

    Without seeing your code its impossible to really help much. Have you logged an SR with Oracle Support to get some help?

    Tim


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.