Tuesday, April 20, 2010

How to Schedule a Report with BI Publisher Web Service?

This is part of the BI Publisher Web Service series. I have already covered ‘How to use BI Publisher Web Service with JDeveloper 11G’ and ‘How to Run a Report with BI Publisher Web Service’. If you haven’t checked the posts and are interested in please click the above links to check.

Today, I’m going to talk about how to schedule a BI Publisher report with the Web Service within a Java application.

Which Method to Schedule Report?

So which method we can use to schedule ? It’s like the ones for running a report, there are two methods. One is ‘scheduleReport() and another is ‘scheduleReportInSession()’. ‘scheduleReport() takes a username and password while scheduleReportInSession takes a session token along with a ‘ScheduleRequest’ object. And both returns a job id, which you can use to monitor and manage the scheduled job later.


  • String scheduleReport(ScheduleRequest srequest, String username, String password)
  • String scheduleReport(ScheduleRequest srequest, String SessionToken)

With those methods you can do pretty much the same things you can do from the UI. I’m going to use scheduleReport() method for my example below.


How to Call scheduleReportInSession()

Before you run the scheduleReportInSession() method, first you need to create a ReportRequest object by giving a report path for the report you want to run. This is exactly the same step I mentioned in the last post with runReportInSession().

Second, you need to create a DeliveryRequest object if you need to deliver the report. You can set a delivery option and its delivery type specific information here.

Third, now you need to create a ScheduleRequest object by setting the ReportRequest and DeliveryRequest objects.

And finally you can call the scheduleReportInSession() method to schedule a report.

Here is a list of those four steps:

  1. Create DeliveryRequest object
  2. Create ReportRequest object
  3. Create ScheduleRequest object
  4. Call scheduleReportInSession() method

So, let’s take a look at the each step.


Create DeliveryRequest Object

1) Create Delivery Option to Set Delivery Information

First you need to create a DeliveryOption object. There are different types of the objects, each of which is for each delivery type. So if you want to deliver your report by email then there is a one DeliveryOption for Email called ‘EmailDeliveryOption’. And it goes the same for other delivery options. Here is a list of the delivery options available for you with BI Publisher.

  • Email
  • Fax
  • FTP
  • Local File System
  • Printer
  • WebDAV

And all the options are available with the Web Service. When you create the DeliveryOption you can set each of the delivery option specific information. For example, if you want to use the email delivery option then you can set the email delivery related information such as an email subject,  an email address shown as ‘from’ or ‘cc’, etc.

Here is a list of the DeliveryOption types and a list of methods that you can use to set the delivery related information.




void setEmailTo(String)

You can set a To Email address.

void setEmailSubject(String)

You can set a Email subject.

void setEmailFrom(String)

You can set a Email From address.

void setEmailCC(String)

You can set a CC Email Address.

void setEmailBody(String)

You can set a Email body message.




void setFaxNumber(String)

You can set a fax number.

void setFaxServer(String)

You can set a fax server name which is the one that has already been registered at your BI Publisher Server.




void setPrinterName(String)

You can set a Printer name that has already been registered at your BI Publisher server environment.

void setPrintNumberOfCopy (String)

You can set a number of copy that you want to print the report in.

void setPrintRange(String)

You can set a range of pages of the report that you want to print.

void setPrintSide(String)

You can set both sides printing.

void setPrintTray(String)

You can specify which printer tray you want to use for your printing.




void setFtpServerName (String)

You can set a FTP server name that has already been registered at your BI Publisher server.

void setFtpUserName(String)

You can set a username for the FTP server.

void setFtpUserPassword (String)

You can set a password for the FTP server.

void setRemoteFile(String)

You can set a file name for the report output.

void setSftpOption(String)

You can set SFTP option.

Local File System



void setDestination(String)

You can set a full path for the report output including the report output file name so that the report can be saved on the specified location on the server’s file system.




void setServer (String)

You can set a WebDAV server name that is registered at your BI Publisher server.

void setRemoteFilePath (String)

You can set a file name for the report output and the path.

void setUserName (String)

You can set a username for the WebDAV server.

void setPassword (String)

You can set a password for the WebDAV server.

void setDeliveryAuthType (String)

You can set an authentication type of the WebDAV server.

void setDeliveryAuthTypeBasic (String)

You can set Basic authentication type.

void setDeliveryAuthTypeDigest (String)

You can set Digest authentication type.

Note that you need to setup the delivery servers appropriately from your BI Publisher Server UI before you use the delivery options with the Web Service. For example, if you want to use the Email delivery option then you need to setup a default Email server from the UI. Only the delivery options configured appropriately at the server can be used from the Web Service.



//Create a Delivery Option for Email delivery
EMailDeliveryOption em = new EMailDeliveryOption();

//Set Email delivery related information
em.setEmailSubject("This is a BIP Web Service Test...");


2) Create Delivery Request

Once you have created the DeliveryOption then you can create a DeliveryRequest object by passing the DeliveryOption object.

Here is a list of the methods that you can use to set the DeliveryOption to create a DeliveryRequest.

  • void setEmailOption (EMailDeliveryOption)
  • void setFaxOption (FaxDeliveryOption)
  • void setPrintOption (PrintDeliveryOption)
  • void setFTPOption (FTPDeliveryOption)
  • void setLocalOption (LocalDeliveryOption)
  • void setWebDAVOption (WebDAVDeliveryOption)


DeliveryRequest dr = new DeliveryRequest();


Create ReportRequest Object

This is exactly the same process as I talked at the last post. So take a look at the post if you don’t know how to create the ReportRequest object.

Create ScheduleRequest Object

When you create the ScheduleRequest object you can set a report to schedule and the delivery information by setting the above mentioned two objects, DeliveryRequest and ReportRequest.

Also, you can set the following information to the ScheduleRequest object.

  • Email Address for Notification
  • Indication of Saving the Data
  • Indication of Saving the Report Output
  • Repeat Count
  • Repeat Interval
  • Start Date for the Scheduling
  • End Date for the Scheduling
  • Calendar for Scheduling
  • Time Zone for Scheduled Time
  • Job Name
  • Delivery Request
  • Report Request
  • Indication of Public Scheduling
  • Bursting Delivery

If you don’t set the Start Date then it would be the same as ‘immediately run’ option.

And here is a list of the methods that you can use to set such options.




Report Request

void setReportRequest (ReportRequest)

You can set a ReportRequest object to select a report that you want to schedule and run.

Delivery Request

void setDeliveryRequest (DeliveryRequest)

You can set a DeliveryRequest object to set a delivery option. See ‘Pre-Requisite for Delivery’ section for the detail of how to set the delivery settings.

Start Date for the Scheduling

void setStartDate(Calendar)

You can set a start date for the scheduling to start. If it’s null or not specified then the scheduled job will run immediately.

End Date for the Scheduling

void setEndDate(Calendar)

You can set an end date for the scheduling.

Job Name

void setUserJobName(String)

You can set a name for this scheduling job.


void setJobCalendar(Calendar)

You can set which calendar to use for the scheduling time. E.g. Gregorian

Time Zone

void setJobTZ(String)

You can set an appropriate time zone that you want to use for the specified time for the scheduling.

Repeat Count

void setRepeatCount(int)

You can set a repeat count for the scheduled job.

Repeat Interval

void setRepeatInterval(int)

You can set an interval time for the scheduled job to run.

Email Address for Notification

void setNotificationTo(String)

You can set an email address to send a notification of the scheduled job.

Request to send a notification message when failed

void setNotificationWhenFailed (boolean)

You can specify whether you want to send a notification message when the scheduled job fails or not.

Request to send a notification message when Success

void setNotificationWhenSuccess (boolean)

You can specify whether you want to send a notification message when the scheduled job runs successfully or not.

Request to send a notification message when Warning

void setNotificationWhenWarning (boolean)

You can specify whether you want to send a notification message when the scheduled job ends with warning or not.

Indication of Saving the Data

void setSaveDataOption(boolean)

You can specify whether you want to save the data for the scheduled job or not. The data will be saved when it’s set True and it can be accessed only through BI Publisher Enterprise UI.

Indication of Saving the Report Output

void setSaveOutputOption(boolean)

You can specify whether you want to save the report output for the scheduled job or not. The output will be saved when it’s set True and it can be accessed only through BI Publisher Enterprise UI.

Indication of Public Scheduling

void setSchedulePublicOption (boolean)

You can specify whether you want to make the scheduled job to be publicly accessible or not.

Bursting Delivery

void setScheduleBurstringOption (boolean)

You can specify whether you want to use the bursting option that is pre-configured for this report or not. In order to use this option you need to make sure that the report you’re scheduling has been configured for the bursting option through BI Publisher Enterprise UI.


ScheduleRequest sreq = new ScheduleRequest();

//Set DeliveryRequest

//Set ReportRequest

//Set scheduling information
sreq.setUserJobName("WebService Job1");


Call scheduleReportInSession()

Now you can set the ScheduleRequest and the session token to run the scheduleReprotInSession() method. It returns a job id when it runs successfully, which you can use to monitor and manage the job. For example, in future when you need to suspend or delete the job then you will need this job id to do such.


job_id = publicReportService.scheduleReportInSession(sreq, sid);

And that’s it! Once you run the scheduleReportInSession() successfully then you should see a new job created from the BI Publisher’s scheduler UI page.

There are more BI Publisher WebService APIs available, but these I’ve covered are the most common. If you have some other APIs that you want me to cover let me know, I can talk about that too.

Here is my whole source code for this scheduling exercise.

package project1;

import com.oracle.xmlns.oxp.service.publicreportservice.AccessDeniedException;
import com.oracle.xmlns.oxp.service.publicreportservice.AccessDeniedException_Exception;
import com.oracle.xmlns.oxp.service.publicreportservice.DeliveryRequest;
import com.oracle.xmlns.oxp.service.publicreportservice.EMailDeliveryOption;
import com.oracle.xmlns.oxp.service.publicreportservice.InvalidParametersException;
import com.oracle.xmlns.oxp.service.publicreportservice.InvalidParametersException_Exception;
import com.oracle.xmlns.oxp.service.publicreportservice.LocalDeliveryOption;
import com.oracle.xmlns.oxp.service.publicreportservice.OperationFailedException;
import com.oracle.xmlns.oxp.service.publicreportservice.OperationFailedException_Exception;
import com.oracle.xmlns.oxp.service.publicreportservice.PublicReportService;
import com.oracle.xmlns.oxp.service.publicreportservice.PublicReportServiceClient;
import com.oracle.xmlns.oxp.service.publicreportservice.PublicReportServiceService;
import com.oracle.xmlns.oxp.service.publicreportservice.ReportRequest;
import com.oracle.xmlns.oxp.service.publicreportservice.ReportResponse;
import com.oracle.xmlns.oxp.service.publicreportservice.ScheduleRequest;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

public class BipServletTest extends HttpServlet {
    private static final String CONTENT_TYPE =
        "text/html; charset=windows-1252";
    private static PublicReportServiceService publicReportServiceService;

    public void init(ServletConfig config) throws ServletException {

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response) throws ServletException,
                                                           IOException {
        OutputStream os = response.getOutputStream();
        //PrintWriter out = response.getWriter();
        String sid = "";
        publicReportServiceService = new PublicReportServiceService(new URL("http://knishida-lap.us.oracle.com:7001/xmlpserver/services/PublicReportService"),
                                               new QName("http://xmlns.oracle.com/oxp/service/PublicReportService",
        PublicReportService publicReportService =

        //To get a session id
       try {
            sid = this.getSessionID("Administrator", "Administrator", publicReportService);
        } catch (AccessDeniedException_Exception e) {
            System.out.println("invalid user"); 

       String job_id = this.scheduleReportInSession(publicReportService, sid);

        try {
        } catch (InvalidParametersException_Exception e) {
        } catch (AccessDeniedException_Exception e) {

public String getSessionID(String username, String password, PublicReportService publicReportService) throws AccessDeniedException_Exception {
    String sid = publicReportService.login(username, password);
    return sid;

public String scheduleReportInSession(PublicReportService publicReportService,
                                    String sid){
    // Set Report request attributes
    ReportRequest req = new ReportRequest();
    req.setReportAbsolutePath("/HR Manager/Employee Salary Report/Employee Salary Report.xdo");

    EMailDeliveryOption em = new EMailDeliveryOption();
    em.setEmailSubject("This is a BIP Web Service Test...");
    DeliveryRequest dr = new DeliveryRequest();
    ScheduleRequest sreq = new ScheduleRequest();
    //Set DeliveryRequest
    //Set ReportRequest
    sreq.setUserJobName("WebService Job1");

    String job_id ="";
    try {
        job_id = publicReportService.scheduleReportInSession(sreq, sid);
    } catch (InvalidParametersException_Exception ie) {
    } catch (AccessDeniedException_Exception ae) {
    } catch (OperationFailedException_Exception oe) {
    return job_id;



  1. Hi,

    I have a question regarding scheduling in BIP. I am creating a report request not by calling API. For example let us consider that I am creating a report request called MyRequest. I am performing following steps:

    1. Create a directory MyRequest
    2. Copy the required rtf file
    3. Copy Sample.xdo to MyRequest directory and rename it to MyRequest.xdo
    4. Modify MyRequest.xdo to change the input file name to MyRequest.xml

    Now, I need to schedule this job. As per my understanding, I have now two options:

    1. Directly insert the job into QRTZ table in database : Is this possible? If possible how do I do that and what are the tables to be updated?

    2. Use BIP APIs to achieve this. If I use BIP API to do this, how do I get the job object that need to be passed along with ScheduleRequest

    Thanks and Regards

  2. Hi Nishida,
    Great Job!!
    You mentioned Running a report using Report Request Function, then about scheduling a report using Schedule Request Function separately, Is there a way we could Schedule and run the same same report at a time by combinign these 2 functions??

  3. Hi Nishida,
    I tried configuring stbeehive.oracle.com as email server. When i tried to schedule reports, I got the following exception

    oracle.apps.xdo.service.delivery.DeliveryException: oracle.apps.xdo.delivery.DeliveryException: Exception reading response;
    nested exception is:
    java.net.SocketException: Connection reset

    Please help.


  4. Hi,

    I am using BIP 11G. I am unable to make webservice call to scheduleReportInSession it throws below error but I am able to execute other api's(runreport,getFolderContentsInSession etc )please help me

    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:119)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
    at $Proxy33.scheduleReportInSession(Unknown Source)
    at PublicReportServiceClient.main(PublicReportServiceClient.java:73)

  5. There is a bug in 11g scheduler web service API. The new release of 11g is coming up pretty soon, within a few weeks, hopefully we can announce this week. I would recommend to wait for a second.

  6. The Issue i have raised was solved by replacing wsdl to but fallen into other issue (it always returns null)

    May be 11G BUG.
    Hi Kanichiro Nishida,
    Could you please provide the link of 11G scheduler bug ?

  7. Could please let me know which version works fine with schduleReport so that I can request our admin team to install

  8. I don't think there is a bug filed, the scheduler WS API just not there in the first release of 11g. Good news is, we just announced the new version of 11g today, the download should be available pretty soon. oh, and this version will provide a full functionality of the scheduling through WS.

  9. Thanks Kanichiro Nishida you have saved my time a lot.
    It's really a good news.
    This page looks gr8 in iphone as well :-) .

  10. Thanks for the comments, Sarada! If not yet, please make sure you follow @bipublisher on twitter, where I'm making all the BIP related important announcements. It's a great way to keep updated.

  11. Could you pls post a blog for lattest version how to schdule report since I am facing few issues while excluding Delivery report

  12. Hi Sarada, the latest release brought all the Schedule related functionality back for the web service and the new doc covers all the APIs available too.


    I'll write a series of the posts with some samples soon, so stay tuned. and please make sure you follow @bipublisher, where I make announcements when I publish a new post.

  13. ScheduleRequest sr = new ScheduleRequest();

    Not working. Testing in eclipse & BIP
    Do we need to set dataModelUrl ?


  14. Thanks for such informative post.

    scheduleReport API :
    For me run now option is working fine by not specifying the start date.
    Setting start date is not working by specifying following.

    Please help.
    Thanks in advance,

  15. I am using OBIEE version

  16. Hi Nishida,

    I am able to make a call to scheduleReportInSession but the return type never match with JOB id in the job history of BIP

    Pls help.

  17. As to the setStartDate looks there is some bug, i'm looking at the workaround, will update soon!

  18. Hi Sarada, are you using or ?

  19. In weblogic, following error is logged when scheduled through webservice.
    'unable to store job with name '1155'and group 'admin' because one already exists with this identification org.quartz.objectalreadyexistsexception'

    If i create 2 post dated jobs through UI then it gets name as num1 and num1+1. Then with WS, WS call returns num1+2 as job name. Not sure still why this error is coming.
    When created through UI no error is shown, instead the action parameters are displayed.

  20. Hi Nishida,

    previous in 11.1.13 getFolderContentsInSession is throwing errors : http://forums.oracle.com/forums/thread.jspa?messageID=9638205&#9638205

    could pls let me know is it because of the parameter "folderAbsolutePath" in in the older version it is "reportAbsolutePath"?

    as per aparna schedulereport returns improper job id is a bug right?

  21. scheduleRequest.setStartDate("2011-06-03T10:10:00");

    Seem to work. Tho, the start Date was not displayed in the OBIEE GUI. Also the interval is in milliseconds (the documentation says it's seconds)

  22. Hi Nishida,

    I am running 1000 templates with bursting and I would like to know the status of the report.
    I am trying to run
    scheduleReportInSession() and the return type I am passing to getScheduledJobInfoInSession() for report status.

    Is this the only way as scheduleReportInSession returns invalid jobid.

    Can this be achived in the other way round?

  23. Hi guys, as to the invalid job id and the getFolderContents, we're checking into now. Will get back.

  24. Hi Sharada/Kanichiro

    Can you tell me which Webservice are you using -v2/scheduleservice or publicreportservice ?

  25. Hi Sharada/Kanichiro

    Can you tell me which BIP WS are you using to make scheduler work - v2/scheduleservice or publicreportservice

  26. Sreevalli,

    It's based upon requirment. If you are looking like report to devlier or burst then v2/scheduleservice

    if you just want to create a report you can go for publicreportservice .
    publicreportservice doesn't have scheduleservices implemented.

  27. Thanks for your response Sarada . We are using v2/scheduleservice and are on . But the method jst returns null instead of job id . any idea ? do you think we need to pass deliveryinfo ? can i have your email id so that i can send my sample code .


  28. Hi Sreevalli,

    There is a bug with the JOB id scheduleReportInSession returns invalid number(actual jobid -1) and sometimes null.Hope Nishida is looking into this issue.
    You can still execute with aparna comment but not 100% success.
    We have raised an SR on this issue. will let you know if it is fixed.

    pls find my email : sarada.taraka@gmail.com

  29. Kanichiro, please let us know if there is a patch to fix the issue with the job_id being null or if there is a workaround, I am experiencing the same issue.

  30. Same here. The reportservice scheduler api returnes a null jobid.

  31. Can anyone tell me , How can one assign existing roles to a newly created role using BI Publisher web services. I am not able to find a any such method in BI Publisher web services.

  32. One more question I have, Is there any way(using web services) to have control over permissions on created folders in catalog of BI Publishers.

    And If not then Is there any other way?

  33. Halo ..

    I'm using BIP 11.1.R5 and I need to burst schedule using local filesystem. I guess, there are different methods. Can you give code snippet, for example .there is no method set* on DeliveryOption.

  34. I need to run a BI Publisher Report when ever there is an update in source DB tables...How can we acheive this thru BI Publisher scheduler? Do we need any Java API's to implement if 'Yes' then how. We need to kick of these Jobs using our Enterprise scheduler Control M.

  35. With the latest BIP now you can use the new feature of Event based job to do this. Or, you can create a db trigger and call a web service of BIP scheduler web service.

    1. Hi Nishida,

      I have few questions, while creating a schedule through web service :

      1. Is it possible to set the frequency like Daily, weekly through web service same as we do have option in BI Publisher scheduling screen.

      2. When we use scheduler web service to set the interval and

  36. Yes, that should be possible.

    1. Hi Kan,

      Thanks for your reply.
      Can you please tell which property of web service to use to set the frequency like - Daily, weekly etc. And also what values to pass in the property.

  37. Hi Nishida,

    I use BI Publisher 11.5 version and I want schedule my report with dynamycal data connection and send my pdf file for example.

    I try using JDBC dynamic data connection with the schedule web service.

    So, I use this code :

    //JDBC Config

    JDBCDataSource jdbc = new JDBCDataSource();


    //BIPDataSource Config

    BIPDataSource bipds = new BIPDataSource();

    and on report request :

    and after :
    and finish with :
    String job_id ="";
    job_id = myPort.scheduleReport(sreq, username, password);

    When I use this code I have no errors and the pdf file was send by e-mail. But the JDBC connection not works.
    For example if I put a wrong password or a wrong url I've not error.

    If I do the same with publicReportService web service I've got error "wrong parameter".

    The JDBC code works with PublicReportWebservice, but in Publisher 11.5 it's not possible schedule report because I have not deliveryChannel or deliveryRequest method in the scheduleRequest class (It's normal ???).

    It's a bug ?? why in publicReportService the JDBC dynamical connection works and why not in Schedule webservice ??
    I can't schedule my report with dynamic data connection ?