We need to add the 3 jars to the project in order to be able to run custom Java jobs.
- schedulerrpccalls.jar
- xdocore.jar
- versioninfor.jar
The code below will call the bip web services, pass in the report xdo absolute path to be run and save the output to the local drive .
import com.oracle.xmlns.oxp.service.v2.AccessDeniedException_Exception;
import com.oracle.xmlns.oxp.service.v2.InvalidParametersException_Exception;
import com.oracle.xmlns.oxp.service.v2.OperationFailedException_Exception;
import com.oracle.xmlns.oxp.service.v2.ReportRequest;
import com.oracle.xmlns.oxp.service.v2.ReportResponse;
import com.oracle.xmlns.oxp.service.v2.ReportService;
import com.oracle.xmlns.oxp.service.v2.ReportService_Service;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJavaExtension;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobException;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobInfo;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class callBIP implements SchedulerJavaExtension {
public static String userID = "weblogic";
public static String password = "welcome1";
private static ReportService_Service reportService_Service;
}
public void run(SchedulerJobInfo jobInfo) throws SchedulerJobException {
reportService_Service = new ReportService_Service();
ReportService reportService = reportService_Service.getV2ReportService();
//Take the first paramater as the report xdo file and call the bip web service
ReportResponse reportOutput =
callBIP.runBipReport(reportService, jobInfo.parameter(0));
//Save output to local drive
String strFilePath = "C://temp//report.pdf";
FileOutputStream out = new FileOutputStream(strFilePath);
out.write(reportOutput.getReportBytes());
out.close();
} catch (IOException e) {
jobInfo.setMessage(e.getMessage());
jobInfo.setStatus(2);
} catch (InvalidParametersException_Exception e) {
jobInfo.setMessage(e.getMessage());
} catch (AccessDeniedException_Exception e) {
jobInfo.setMessage(e.getMessage());
} catch (OperationFailedException_Exception e) {
jobInfo.setMessage(e.getMessage());
public static ReportResponse runBipReport(ReportService reportService,
String reportName) throws InvalidParametersException_Exception,
AccessDeniedException_Exception,
OperationFailedException_Exception,
ReportRequest req = new ReportRequest();
req.setAttributeLocale("en-US");
req.setAttributeFormat("pdf");
req.setReportAbsolutePath(reportName);
ReportResponse reportOutput = reportService.runReport(req, userID, password);
return reportOutput;
}
}
}
Compile the code and deploy the JAR file to the javahost lib directory.
Change the javahost config.xml flag to enable custom java code processing by javahost.
Start Job Manager and enter the class name bip.callBIP, the class Path jar file: bipFile.jar. The report full xdo path is passed as a parameter in the parameters section
Execute the job et voila
Of course reports can be scheduled as well using this approach.
a+
Fiston