This function is used to manage the Yellowfin database by using SQL query. For instance, you can retrieve information from the database by using the SELECT command, as well as manage the database tables by using DELETE and INSERT. Note that this function requires the password for the database, however this can be disabled by changing the setting, discussed below.
Click below to see how to enable this functionality for your environment, and change its setting.
- Open the web.xml file from the WEB-INF directory (appserver\webapp\ROOT\WEB-INF\web.xml).
Then add the following code to the MIStartup servlet section of the file:
<init-param>
<param-name>EnableQueryWebservice</param-name>
<param-value>TRUE</param-value>
</init-param> |
By default this function will require the database password, but you can add the following code to the same section of the file to disable this requirement. Otherwise skip this step.
<init-param>
<param-name>DisableQueryWebservicePassword</param-name>
<param-value>TRUE</param-value>
</init-param> |
- Save the web.xml file, and restart Yellowfin, if you had it running.
- If this web service was not enabled, you will see the "Query Webservice not enabled" error in the Yellowfin logs after performing the METADATASQLQUERY call.
|
Request ParametersThe following parameters should be passed with this request: Request Element | Data Type | Description |
---|
LoginId | String | An administrator account to connect to the Yellowfin web services. This can either be the user ID or the email address, depending on the Logon ID method. This 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. | Function | String | Web service function. Set this to "METADATASQLQUERY". | Query | String | The SQL query that you want to perform on the Yellowfin database. | Parameters | String[] | Use this to pass the Yellowfin database password. Only the first element of the array is required (which you can set as the password). However, if this requirement has been disabled (as mentioned in the steps above, then this parameter will not be required. |
Request ExampleBelow is a SOAP XML example for this request: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/">
<soapenv:Header/>
<soapenv:Body>
<web:remoteAdministrationCall>
<arg0>
<loginId>admin@yellowfin.com.au</loginId>
<password>test</password>
<orgId>1</orgId>
<function>METADATASQLQUERY</function>
<query>SELECT * FROM person</query>
</arg0>
</web:remoteAdministrationCall>
</soapenv:Body>
</soapenv:Envelope> |
Response ParametersThe returned response will contain these parameters: Response Element | Data Type | Description |
---|
StatusCode | String | Status of the web service call. Possible values include: | QueryResults | ReportRow | Array of the result set rows if SELECT was the request query. |
Response ExampleThe service will return the below response, according to our SOAP example:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/">
<return>
<errorCode>0</errorCode>
<messages>Successfully Authenticated User: admin@yellowfin.com.au</messages>
<messages>Web Service Request Complete</messages>
<queryResults>
<dataValue>5</dataValue>
<dataValue>Administrator</dataValue>
<dataValue>System</dataValue>
<dataValue/>
<dataValue/>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue>ATMN SSTM</dataValue>
<dataValue/>
<dataValue>System Administrator</dataValue>
<dataValue>System Administrator</dataValue>
<dataValue>EN</dataValue>
<dataValue>PRIVATE</dataValue>
<dataValue>4</dataValue>
<dataValue>EMAIL</dataValue>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue>AUSTRALIA/SYDNEY</dataValue>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<dataValue>ACTIVE</dataValue>
</queryResults>
<sessionId>804451ca30ad4a3065e4b67a9293440c</sessionId>
<statusCode>SUCCESS</statusCode>
</return>
</ns2:remoteAdministrationCallResponse>
</S:Body>
</S:Envelope> |
InstructionsSee below for step-by-step instructions on how to perform this call, using a Java example: Provide the SQL query that you wish to perform:
rsr.setQuery("SELECT * FROM configuration WHERE ConfigTypeCode = 'SYSTEM'"); |
Once the request is configured, simply perform the call to test the server:
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr); |
Initialize the Administration web service. Click here to learn how to do this.
|
Complete ExampleBelow is a full example of this web service call. To use it for yourself, carry out the following the steps: - Copy the code and save it as ws_metadatasqlquery.jsp.
- Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
- Adjust the host, port, and admin user details according to your environment.
- Run http://<host>:<port>/ws_metadatasqlquery.jsp from your Internet browser.
<%
/* ws_metadatasqlquery.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.*" %>
<%
AdministrationServiceService s_adm = new AdministrationServiceServiceLocator("localhost",8080, "/services/AdministrationService", false); // adjust host and port number
AdministrationServiceSoapBindingStub adminService = (AdministrationServiceSoapBindingStub) s_adm.getAdministrationService();
AdministrationServiceRequest rsr = new AdministrationServiceRequest();
rsr.setLoginId("admin@yellowfin.com.au"); // provide your Yellowfin web services admin account
rsr.setPassword("test"); // change to the password of the account above
rsr.setOrgId(1);
rsr.setFunction("METADATASQLQUERY");
rsr.setQuery("SELECT * FROM configuration WHERE ConfigTypeCode = 'SYSTEM'");
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
if ("SUCCESS".equals(rs.getStatusCode()) ) {
out.write("<br>Success");
ReportRow[] rows = rs.getQueryResults();
if (rows != null)
for (ReportRow rr: rows){
String[] str = rr.getDataValue();
out.write("<br>");
for (String s: str)
out.write("<br>" + s);
}
}
else {
out.write("<br>Failure");
out.write(" Code: " + rs.getErrorCode());
}
%>
|
|