These report web services allows user to generate a report in a different format.
This function returns a specified report in the XLS or XLSX format (Excel spreadsheet).
Request Elements
The following elements will be passed with this request:
Request Element | Data Type | Description |
---|---|---|
LoginId | String | Yellowfin web services administrator user Id. This can be the user ID or the email address, depending on the Logon ID method. This Yellowfin account must have the “web services” role enabled, and must belong to the Default (i.e. Primary) Org. |
Password | String | Password of the above account. |
OrgId | Integer | Default (i.e. Primary) organization ID within Yellowfin. Always set this to 1. |
ReportRequest | String | Web services function. Set this to "XLSX" or ""XLS". |
ReportId | Integer | An internal ID to specify the report to be returned in XLSX/XLS form. |
Request Example
The following SOAP example shows the parameters that you can pass to this call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteReportCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <reportRequest>XLSX</reportRequest> <reportId>56401</reportId> </arg0> </web:remoteReportCall> </soapenv:Body> </soapenv:Envelope>
Response Elements
The response will contain these parameters:
Response Element | Data Type | Description |
---|---|---|
StatusCode | String | Status of the web service call. Possible values include:
|
ReportId | Integer | ID of the specified report. |
ReportName | String | Name of the specified report. |
HitCount | Integer | Number of times the specified report has been accessed. |
FormatCode | String | Format code of the specified report. |
BinaryData | String | Report data as Base64 encoded binary chunk of XLSX. |
ContentType | String | MIME Content Type of this object. Value will be “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet” |
Response Example
The service will return the below response, according to our SOAP example:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:remoteReportCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/"> <return> <author>System Administrator</author> <authoringMode>JAVA</authoringMode> <averageRunTime>0</averageRunTime> <binaryData>UEsDBBQACAgIAJUKa0wAAAAAAAAAAAAAAAALAAAAX3JlbHMvLnJlb ...</binaryData> <canDrill>false</canDrill> <category>Audit Reports</category> <contentType>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</contentType> <dashboardEnabled>true</dashboardEnabled> <dataOutput>COLUMN</dataOutput> <datasource>Yellowfin Configuration Database</datasource> <errorCode>0</errorCode> <formatCode>REPORTANDCHART</formatCode> <hitCount>25</hitCount> <lastModifiedDate>2016-03-29</lastModifiedDate> <lastRunDuration>0</lastRunDuration> <lastRunStatus>RUN_NOERROR</lastRunStatus> <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages> <messages>Loaded Report: 56401 Successfully</messages> <messages>Generating XLS Report</messages> <messages>Request Contains No ReportFilter Records.</messages> <messages>Report Run Successfully</messages> <messages>Web Service Request Complete</messages> <preRunFilterString><![CDATA[<div class="rptFilterLogicText"> <span class="rptFilterLogicIdentifier">Active Session Start</span> Is Not Null <span class="rptFilterLogicIdentifier"></span> </div>]]></preRunFilterString> <private>false</private> <reportDescription/> <reportId>56401</reportId> <reportName>Active Sessions</reportName> <reportTemplate>REPORTANDCHART</reportTemplate> <reportUUID>594d4da4-1b58-44d3-bf4f-11456a42f68c</reportUUID> <reportUsage>26</reportUsage> <sessionId>18097e8275689f88876f004a07935a7c</sessionId> <statusCode>SUCCESS</statusCode> <subCategory>Admin Reports</subCategory> <tags>No tags</tags> <viewName>NEW VIEW</viewName> </return> </ns2:remoteReportCallResponse> </S:Body> </S:Envelope>
Instructions
See below for step-by-step instructions on how to perform this call, using a Java example:
Here's a basic request to perform this call, which includes logging in as the admin user and specifying the web service call to perform:
ReportServiceRequest rsr = new ReportServiceRequest(); rsr.setLoginId("admin@yellowfin.com.au"); rsr.setPassword("test"); rsr.setOrgId(new Integer(1)); rsr.setReportRequest("XLSX");
If you need to specify the client org where the report exists, add this to your code:
rsr.setOrgRef("org1"); // search for the report in this client org
Specify which report to convert into XLSX format:
rsr.setReportId(60712);
Once the request is configured, carry out the call:
ReportServiceResponse rs=rsc.remoteReportCall(rsr);
Initialize the Report web service. Click here to learn how to do this.
The response returned will contain the parameters including, StatusCode, ReportID, BinaryData, etc. (See the Response Parameters table above for more details.)
Complete Example
Below is a full example of this function. To use it for yourself, carry out the following the steps:
- Copy the code and save it as ws_xlsxreport.jsp.
- Put the file in the root folder, which is Yellowfin/appserver/webapps/ROOT.
- Adjust host, port, and admin user to add details according to your environment.
- Run http://<host>:<port>/ws_xlsxreport.jsp from your Internet browser.
/* ws_xlsxreport.jsp */ <%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ page import="com.hof.util.*, java.util.*, java.text.*" %> <%@ page import="com.hof.web.form.*" %> <%@ page import="com.hof.mi.web.service.*" %> <%@ page import="javax.xml.bind.JAXBContext" %> <%@ page import="javax.xml.bind.Marshaller" %> <%@ page import="java.io.StringWriter" %> <%@ page import="javax.xml.bind.JAXBElement" %> <%@ page import="javax.xml.namespace.QName" %> <% /* Create Group Using Java generated stubs rather that using the Yellowfin webservices API.. */ ReportService rsc = new ReportService(); //("localhost", 8080, "admin@yellowfin.com.au", "test", "/services/ReportService"); ReportServiceRequest rsr = new ReportServiceRequest(); rsr.setLoginId("admin@yellowfin.com.au"); rsr.setPassword("test"); rsr.setOrgId(new Integer(1)); rsr.setReportRequest("XLSX"); rsr.setOrgRef("1"); rsr.setReportId(60712); rsr.setReportClientReferenceId("1"); ReportServiceResponse rs=rsc.remoteReportCall(rsr); if ("SUCCESS".equals(rs.getStatusCode())) { JAXBContext context = JAXBContext.newInstance(ReportServiceResponse.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // To format XML JAXBElement<ReportServiceResponse> rootElement = new JAXBElement<ReportServiceResponse>(new QName("ReportServiceResponse"), ReportServiceResponse.class, rs); m.marshal(rootElement,out); //out.write("Success"); } else { out.write("Failure"); out.write(" Code: " + rs.getErrorCode()); } %>
This function returns a specified report in the DOC or DOCX form (Microsoft Word).
Request Elements
The following elements will be passed with this request:
Request Element | Data Type | Description |
---|---|---|
LoginId | String | Yellowfin web services administrator user Id. This can be the user ID or the email address, depending on the Logon ID method. This Yellowfin account must have the “web services” role enabled, and must belong to the Default (i.e. Primary) Org. |
Password | String | Password of the above account. |
OrgId | Integer | Default (i.e. Primary) organization ID within Yellowfin. Always set this to 1. |
ReportRequest | String | Web services function. Set this to "DOCX" or "DOC". |
ReportId | Integer | An internal ID to specify the report to be returned in DOCX/DOC form. |
Request Example
The following SOAP example shows the parameters that you can pass to this call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteReportCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <reportRequest>DOCX</reportRequest> <reportId>56401</reportId> </arg0> </web:remoteReportCall> </soapenv:Body> </soapenv:Envelope>
Response Elements
The response returned will contain these parameters:
Response Element | Data Type | Description |
---|---|---|
StatusCode | String | Status of the web service call. Possible values include:
|
ReportId | Integer | ID of the specified report. |
ReportName | String | Name of the specified report. |
HitCount | Integer | Number of times the specified report has been accessed. |
FormatCode | String | Format code of the specified report. |
BinaryData | String | Report data as Base64 encoded binary chunk of DOCX. |
ContentType | String | MIME Content Type of this object. Value will be “application/vnd.openxmlformats-officedocument.wordprocessingml.document” |
Response Example
The service will return the below response, according to our SOAP example:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:remoteReportCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/"> <return> <author>System Administrator</author> <authoringMode>JAVA</authoringMode> <averageRunTime>0</averageRunTime> <binaryData>UEsDBBQACAgIAN0Ma0wAAAAAAAAAAAAAAAATAAAAW0 ...</binaryData> <canDrill>false</canDrill> <category>Audit Reports</category> <contentType>application/vnd.openxmlformats-officedocument.wordprocessingml.document</contentType> <dashboardEnabled>true</dashboardEnabled> <dataOutput>COLUMN</dataOutput> <datasource>Yellowfin Configuration Database</datasource> <errorCode>0</errorCode> <formatCode>REPORTANDCHART</formatCode> <hitCount>26</hitCount> <lastModifiedDate>2016-03-29</lastModifiedDate> <lastRunDuration>0</lastRunDuration> <lastRunStatus>RUN_NOERROR</lastRunStatus> <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages> <messages>Loaded Report: 56401 Successfully</messages> <messages>Generating DOCX Report</messages> <messages>Request Contains No ReportFilter Records.</messages> <messages>Report Run Successfully</messages> <messages>Web Service Request Complete</messages> <preRunFilterString><![CDATA[<div class="rptFilterLogicText"> <span class="rptFilterLogicIdentifier">Active Session Start</span> Is Not Null <span class="rptFilterLogicIdentifier"></span> </div>]]></preRunFilterString> <private>false</private> <reportDescription/> <reportId>56401</reportId> <reportName>Active Sessions</reportName> <reportTemplate>REPORTANDCHART</reportTemplate> <reportUUID>594d4da4-1b58-44d3-bf4f-11456a42f68c</reportUUID> <reportUsage>27</reportUsage> <sessionId>9b4a5e7182d359795d176d56378ac0f2</sessionId> <statusCode>SUCCESS</statusCode> <subCategory>Admin Reports</subCategory> <tags>No tags</tags> <viewName>NEW VIEW</viewName> </return> </ns2:remoteReportCallResponse> </S:Body> </S:Envelope>
Instructions
See below for step-by-step instructions on how to perform this call, using a Java example:
Here's a basic request to perform this call, which includes logging in as the admin user and specifying the web service call to perform:
ReportServiceRequest rsr = new ReportServiceRequest(); rsr.setLoginId("admin@yellowfin.com.au"); rsr.setPassword("test"); rsr.setOrgId(new Integer(1)); rsr.setReportRequest("DOCX");
If you need to specify the client org where the report exists, add this to your code:
rsr.setOrgRef("org1"); // search for the report in this client org
Specify which report to convert into DOCX format:
rsr.setReportId(60712);
Once the request is configured, carry out the call:
ReportServiceResponse rs=rsc.remoteReportCall(rsr);
Initialize the Report web service. Click here to learn how to do this.
The response returned will contain the parameters including, StatusCode, ReportID, BinaryData, etc. (See the Response Parameters table above for more details.)
Complete Example
Below is a full example of this function. To use it for yourself, carry out the following the steps:
- Copy the code and save it as ws_docxreport.jsp.
- Put the file in the root folder, which is Yellowfin/appserver/webapps/ROOT.
- Adjust host, port, and admin user to add details according to your environment.
- Run http://<host>:<port>/ws_docxreport.jsp from your Internet browser.
/* ws_docxreport.jsp */ <%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ page import="com.hof.util.*, java.util.*, java.text.*" %> <%@ page import="com.hof.web.form.*" %> <%@ page import="com.hof.mi.web.service.*" %> <%@ page import="javax.xml.bind.JAXBContext" %> <%@ page import="javax.xml.bind.Marshaller" %> <%@ page import="java.io.StringWriter" %> <%@ page import="javax.xml.bind.JAXBElement" %> <%@ page import="javax.xml.namespace.QName" %> <% ReportService rsc = new ReportService(); //("localhost", 8080, "admin@yellowfin.com.au", "test", "/services/ReportService"); ReportServiceRequest rsr = new ReportServiceRequest(); rsr.setLoginId("admin@yellowfin.com.au"); rsr.setPassword("test"); rsr.setOrgId(new Integer(1)); rsr.setReportRequest("DOCX"); rsr.setOrgRef("1"); rsr.setReportId(60712); rsr.setReportClientReferenceId("1"); ReportServiceResponse rs=rsc.remoteReportCall(rsr); if ("SUCCESS".equals(rs.getStatusCode())) { JAXBContext context = JAXBContext.newInstance(ReportServiceResponse.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // To format XML JAXBElement<ReportServiceResponse> rootElement = new JAXBElement<ReportServiceResponse>(new QName("ReportServiceResponse"), ReportServiceResponse.class, rs); m.marshal(rootElement,out); //out.write("Success"); } else { out.write("Failure"); out.write(" Code: " + rs.getErrorCode()); } %>