This web service can be used to create a new Yellowfin data source connection or modify an existing one. For this to work properly, you will need to provide all the parameters for the AdministrationDataSource object, otherwise important parameters will be replaced with NULLs. Currently, there is no way to create a source in a client org; this can only be done in the default organization. However, once a new data source is created by using this function, and its source ID generated, you can use the METADATASQLQUERY web service to attach the new source to the client org by providing its sourceId. The lines below show you how to pass this source ID, in the usual Yellowfin java code example.
rsr.setFunction(“METADATASQLQUERY”); rsr.setQuery(“UPDATE reportviewsource SET IpOrg = “ + clientOrgID + “WHERE SourceId = “ + sourceID);
Request ParametersThe following parameters should be passed with this request: Request Element | Data Type | Description |
---|
LoginId | String | An admin account to connect to Yellowfin web services. This can 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 "SAVEDATASOURCE". | Datasource | AdministrationDataSource | The data source object to modify or create. See the table below. |
The following parameters will need to be specified in the AdministrationDataSource object: Request Element | Data Type | Description |
---|
AccessLevelCode | String | To specify the permission/access level of this database. | ClientSources | AdministrationDataSourceClientLink |
| ConnectionDriver | String | Driver used to connect to data source. | ConnectionPath | String |
| ConnectionString | String | Data source's connection string. | ConnectionTimeout | Integer | This is specified in seconds. | ConnectionType | String | Type of the connection. Example includes, JDBC, etc. | ConnectionTypeCode | String |
| InheritChildSourceFilters | Boolean |
| LogFile | String |
| MaxRows | Integer | Max number of data rows retrieved. | MaxmimumConnections | Integer |
| MinimumConnections | Integer |
| RefreshTime | Integer | This is specified in hours. | SourceDescription | String | Description of data source. | SourceId | Integer | Unique Yellowfin ID for the data source. This must be specified when editing an existing data source, because if not provided, a new data source will be created. | SourceName | String | Name of the data source. | SourceOptions | AdministrationDataSourceOption | See table below. | SourceType | String | Type of data source. Example includes, MySQL, Oracle, etc. | Timezone | String |
| UserName | String | Username for the data source account. | UserPassword | String | Password of the above account. The password will be encrypted automatically when saving the data source. |
The following parameters will be required for the AdministrationDataSourceOption objection: The AdministrationDataSourceOption is different for different sources. To find out what values to put in the listed properties, perform the LOADDATASOUCE call on a type of Yellowfin source connection you want to write a script for. |
Parameter | Type |
---|
OptionKey | String | OptionValue | String | ValueDataType | String |
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>SAVEDATASOURCE</function>
<datasource>
<accessLevelCode>UNSECURE</accessLevelCode>
<connectionDriver>com.mysql.jdbc.Driver</connectionDriver>
<connectionPath/>
<connectionString>jdbc:mysql://localhost:3306/default</connectionString>
<connectionTimeout>180</connectionTimeout>
<connectionType>JDBC</connectionType>
<connectionTypeCode>GENERICUSER</connectionTypeCode>
<inheritChildSourceFilters>false</inheritChildSourceFilters>
<maxRows>10000</maxRows>
<maxmimumConnections>5</maxmimumConnections>
<minimumConnections>1</minimumConnections>
<refreshTime>3</refreshTime>
<sourceDescription/>
<sourceName>Default</sourceName>
<sourceOptions>
<optionKey>ISOLATIONLEVEL</optionKey>
<optionValue>1</optionValue>
<valueDataType>1</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>USESCHEMA</optionKey>
<optionValue>true</optionValue>
<valueDataType>6</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>HOSTNAME</optionKey>
<optionValue>localhost</optionValue>
<valueDataType>2</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>PORT</optionKey>
<optionValue>3306</optionValue>
<valueDataType>1</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>DATABASE</optionKey>
<optionValue>default</optionValue>
<valueDataType>2</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>USEFETCHSIZE</optionKey>
<optionValue>false</optionValue>
<valueDataType>6</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>FETCHSIZE</optionKey>
<optionValue/>
<valueDataType>2</valueDataType>
</sourceOptions>
<sourceOptions>
<optionKey>YF_DRIVER_SELECTION</optionKey>
<optionValue>com.mysql.jdbc.Driver</optionValue>
<valueDataType>2</valueDataType>
</sourceOptions>
<sourceType>MYSQL</sourceType>
<timezone>AUSTRALIA/SYDNEY</timezone>
<userName>root</userName>
<userPassword>root</userPassword>
</datasource>
</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: | LoadedDataSources | AdministrationDataSource | Object array containing details of the saved data source. |
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>
<loadedDataSource>
<accessLevelCode>UNSECURE</accessLevelCode>
<connectionDriver>com.mysql.jdbc.Driver</connectionDriver>
<connectionPath/>
<connectionString>jdbc:mysql://localhost:3306/default</connectionString>
<connectionTimeout>180</connectionTimeout>
<connectionType>JDBC</connectionType>
<connectionTypeCode>GENERICUSER</connectionTypeCode>
<inheritChildSourceFilters>false</inheritChildSourceFilters>
<maxRows>10000</maxRows>
<maxmimumConnections>5</maxmimumConnections>
<minimumConnections>1</minimumConnections>
<refreshTime>3</refreshTime>
<sourceDescription/>
<sourceId>74374</sourceId>
<sourceName>Default</sourceName>
<sourceType>MYSQL</sourceType>
<timezone>AUSTRALIA/SYDNEY</timezone>
<userName>root</userName>
<userPassword>kOjvh+lsaec=</userPassword>
</loadedDataSource>
<messages>Successfully Authenticated User: admin@yellowfin.com.au</messages>
<messages>Web Service Request Complete</messages>
<sessionId>5bcaabd9865824d45b1768eddb21c99e</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: Define the request for this function, which includes logging in as the admin user and specifying the web service call to perform:
AdministrationServiceRequest rsr = new AdministrationServiceRequest();
rsr.setLoginId("admin@yellowfin.com.au");
rsr.setPassword("test");
rsr.setOrgId(new Integer(1));
rsr.setFunction("SAVEDATASOURCE"); |
Provide details of the data source connection to be created or updated. AdministrationDataSource source = new AdministrationDataSource();
source.setAccessLevelCode("UNSECURE");
source.setConnectionDriver("com.mysql.jdbc.Driver");
source.setConnectionPath("");
source.setConnectionString("jdbc:mysql://localhost:3306/org1");
source.setConnectionTimeout(180);
source.setConnectionType("JDBC");
source.setConnectionTypeCode("GENERICUSER");
source.setInheritChildSourceFilters(false);
source.setMaxRows(10000);
source.setMaxmimumConnections(5);
source.setMinimumConnections(1);
source.setRefreshTime(3);
source.setSourceDescription("Org 1");
source.setSourceName("org1");
source.setSourceType("MYSQL");
source.setTimezone("AUSTRALIA/SYDNEY");
source.setUserName("root");
source.setUserPassword("root"); |
Specify the data source option details: AdministrationDataSourceOption[] options = new AdministrationDataSourceOption[8];
options[0] = new AdministrationDataSourceOption();
options[0].setOptionKey("ISOLATIONLEVEL");
options[0].setOptionValue("1");
options[0].setValueDataType("1");
options[1] = new AdministrationDataSourceOption();
options[1].setOptionKey("USESCHEMA");
options[1].setOptionValue("true");
options[1].setValueDataType("6");
options[2] = new AdministrationDataSourceOption();
options[2].setOptionKey("HOSTNAME");
options[2].setOptionValue("localhost");
options[2].setValueDataType("2");
options[3] = new AdministrationDataSourceOption();
options[3].setOptionKey("PORT");
options[3].setOptionValue("3306");
options[3].setValueDataType("1");
options[4] = new AdministrationDataSourceOption();
options[4].setOptionKey("DATABASE");
options[4].setOptionValue("org1");
options[4].setValueDataType("2");
options[5] = new AdministrationDataSourceOption();
options[5].setOptionKey("USEFETCHSIZE");
options[5].setOptionValue("false");
options[5].setValueDataType("6");
options[6] = new AdministrationDataSourceOption();
options[6].setOptionKey("FETCHSIZE");
options[6].setOptionValue("");
options[6].setValueDataType("2");
options[7] = new AdministrationDataSourceOption();
options[7].setOptionValue("com.mysql.jdbc.Driver");
options[7].setValueDataType("2");
source.setSourceOptions(options);
rsr.setDatasource(source); |
Once the request is configured, perform the call:
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_savedatasource.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_savedatasource.jsp from your Internet browser.
<%
/* ws_savedatasource.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("SAVEDATASOURCE");
AdministrationDataSource source = new AdministrationDataSource();
source.setAccessLevelCode("UNSECURE");
source.setConnectionDriver("com.mysql.jdbc.Driver");
source.setConnectionPath("");
source.setConnectionString("jdbc:mysql://localhost:3306/org1");
source.setConnectionTimeout(180);
source.setConnectionType("JDBC");
source.setConnectionTypeCode("GENERICUSER");
source.setInheritChildSourceFilters(false);
source.setMaxRows(10000);
source.setMaxmimumConnections(5);
source.setMinimumConnections(1);
source.setRefreshTime(3);
source.setSourceDescription("Org 1");
source.setSourceName("org1");
source.setSourceType("MYSQL");
source.setTimezone("AUSTRALIA/SYDNEY");
source.setUserName("root");
source.setUserPassword("root");
AdministrationDataSourceOption[] options = new AdministrationDataSourceOption[8];
options[0] = new AdministrationDataSourceOption();
options[0].setOptionKey("ISOLATIONLEVEL");
options[0].setOptionValue("1");
options[0].setValueDataType("1");
options[1] = new AdministrationDataSourceOption();
options[1].setOptionKey("USESCHEMA");
options[1].setOptionValue("true");
options[1].setValueDataType("6");
options[2] = new AdministrationDataSourceOption();
options[2].setOptionKey("HOSTNAME");
options[2].setOptionValue("localhost");
options[2].setValueDataType("2");
options[3] = new AdministrationDataSourceOption();
options[3].setOptionKey("PORT");
options[3].setOptionValue("3306");
options[3].setValueDataType("1");
options[4] = new AdministrationDataSourceOption();
options[4].setOptionKey("DATABASE");
options[4].setOptionValue("org1");
options[4].setValueDataType("2");
options[5] = new AdministrationDataSourceOption();
options[5].setOptionKey("USEFETCHSIZE");
options[5].setOptionValue("false");
options[5].setValueDataType("6");
options[6] = new AdministrationDataSourceOption();
options[6].setOptionKey("FETCHSIZE");
options[6].setOptionValue("");
options[6].setValueDataType("2");
options[7] = new AdministrationDataSourceOption();
options[7].setOptionValue("com.mysql.jdbc.Driver");
options[7].setValueDataType("2");
source.setSourceOptions(options);
rsr.setDatasource(source);
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
if ("SUCCESS".equals(rs.getStatusCode()) ) {
out.write("<br>Success");
}
else {
out.write("<br>Failure");
out.write(" Code: " + rs.getErrorCode());
}
%> |
|