我正在尝试通过Web服务在BI发布者中安排报告。
我将所需参数传递给ScheduleReport方法后, 我必须得到job_id。但问题是我没有获得任何转让,也没有产生任何错误。
我该如何解决这个问题?有些人可以帮助我摆脱它。谢谢你。 我在下面附上了我的代码。
package com.bip.client;
import com.bip.services.ArrayOfParamNameValue;
import com.bip.services.ArrayOfString;
import com.bip.services.ReportDefinition;
import com.bip.services.ReportRequest;
import com.bip.services.ReportResponse;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceRef;
public class PublicReportServiceClient {
@WebServiceRef
private static PublicReportServiceService publicReportServiceService;
public static void main(String[] arg) throws MalformedURLException, AccessDeniedException
{
publicReportServiceService = new PublicReportServiceService();
try
{
//Creating client class for the above mention BIP URL.
URL url;
url = new URL("http://localhost:7001/xmlpserver/services/PublicReportService");
QName qname;
qname = new QName("http://xmlns.oracle.com/oxp/service/PublicReportService", "PublicReportServiceService");
publicReportServiceService = new PublicReportServiceService(url, qname);
PublicReportService publicReportService;
publicReportService = publicReportServiceService.getPublicReportService();
String sessionId;
sessionId = publicReportService.login("weblogic", "weblogic123");
System.out.println("sessionId : " + sessionId);
ArrayOfString values = new ArrayOfString();
values.getItem().add("AT1"); //value of the input parameter
ReportDefinition reportDef = publicReportService.getReportDefinitionInSession("/~weblogic/account_details.xdo", sessionId);
ArrayOfParamNameValue valArray = reportDef.getReportParameterNameValues();
ArrayOfString parameter = reportDef.getParameterNames();
for(int i=0; i<parameter.getItem().size(); i++)
{
System.out.println("Cols : "+parameter.getItem().get(i));
valArray.getItem().get(i).setValues(values);
}
//Creating ReportRequest object and set required values
ReportRequest req = new ReportRequest();
req.setAttributeFormat("pdf"); //type of the report
req.setAttributeLocale("en-US"); //Language
req.setAttributeTemplate("Simple"); //Template type
req.setReportAbsolutePath("/~weblogic/account_details.xdo"); //Absolute path of the report from BIP Catalog.
req.setSizeOfDataChunkDownload(-1); //to download all
req.setParameterNameValues(valArray);
//Create ReportResponse object to create report based on ReportRequest object.
ReportResponse res;
res = new ReportResponse();
res = publicReportService.runReportInSession(req, sessionId);
ScheduleRequest sreq = new ScheduleRequest();
sreq.setReportRequest(req);//Set ReportRequest
//Set scheduling information
sreq.setNotificationTo("abcde@xxx.com");
sreq.setSaveDataOption(true);
sreq.setBookBindingOutputOption(false);
sreq.setMergeOutputOption(true);
sreq.setNotifyWhenFailed(true);
sreq.setNotifyWhenSuccess(true);
sreq.setNotifyWhenWarning(true);
sreq.setRepeatCount(1);
sreq.setUseUTF8Option(true);
sreq.setScheduleBurstringOption(false);
sreq.setSchedulePublicOption(true);
sreq.setUserJobName("WebService Job1");
sreq.setRepeatInterval(1);
String job_id = publicReportService.scheduleReportInSession(sreq, sessionId);
System.out.println("job_id:"+ job_id);
}catch (MalformedURLException murle) {
System.out.println("given URL is invalid");
murle.printStackTrace();
} catch (AccessDeniedException ade) {
System.out.println("invalid user id and password");
ade.printStackTrace();
} catch (InvalidParametersException ipe) {
ipe.printStackTrace();
} catch (OperationFailedException ofe) {
ofe.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
我得到了这个输出,
sessionId : AF1E5BDDE84C5F24A78FFDE733F99101
Cols : BRANCH_CODE
job_id:
答案 0 :(得分:0)
在这里回复有点晚,对不起...
Here's a nice little summary of submitting a job
链接页面的四个步骤:
我是新来的,但是您在这里做两件事,实时运行报告
//Create ReportResponse object to create report based on ReportRequest object.
ReportResponse res;
res = new ReportResponse();
res = publicReportService.runReportInSession(req, sessionId);
并将报告提交给BI Publishers调度程序。
String job_id = publicReportService.scheduleReportInSession(sreq, sessionId);
System.out.println("job_id:"+ job_id);
不确定您是否打算这样做,在调用runReportInSession()之后,应在响应对象(res.getReportBytes())中包含pdf。
就调度程序作业ID而言,我认为您需要一个传递请求对象,或使用setSaveOutputOption(true)保存报告输出。
EMailDeliveryOption em = new EMailDeliveryOption();
em.setEmailTo("someone@somecompany.com");
em.setEmailSubject("Here's your BI Publisher report...");
em.setEmailFrom("me@mycompany.com");
em.setEmailCC("myBoss@mycompany.com");
em.setEmailBody("Here's your report");
DeliveryRequest dr = new DeliveryRequest();
dr.setEmailOption(em);
...
//Set DeliveryRequest
sreq.setDeliveryRequest(dr);