%@page import="java.net.URLConnection"%>
<%@page import="java.net.URL"%>
<%! private static final String cvsId = "$Id: ws_admin_singlesignon.jsp,v 1.1 2012/02/17 02:26:51 steve Exp $"; %>
<%@ 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.*" %>
<%
/*
DON'T FORGET TO ADD THE FOLLOWING TO web.xml MISTARTUP servlet section TO AVOID setting the DB user credentials here
EnableQueryWebservice
TRUE
DisableQueryWebservicePassword
TRUE
*/
AdministrationServiceResponse rs = null;
AdministrationServiceRequest rsr = new AdministrationServiceRequest();
AdministrationServiceServiceLocator asi = new AdministrationServiceServiceLocator();
AdministrationServiceInterface rssbs = asi.getAdministrationService(new URL("http://localhost:7373/services/AdministrationService"));
rsr.setLoginId("admin@yellowfin.com.au");
rsr.setPassword("test");
rsr.setOrgId(new Integer(1));
rsr.setFunction("METADATASQLQUERY");
//your database username - You will only need to do this if you haven't added the 2 params in web.xml
// rsr.setParameters(new String[] { "root" });
rsr.setQuery("SELECT SQLText FROM ReportInstance WHERE ReportId = 61656");
rs = rssbs.remoteAdministrationCall(rsr);
if ("SUCCESS".equals(rs.getStatusCode()) ) {
for (ReportRow r : rs.getQueryResults()) {
for (String s: r.getDataValue()) {
if (s!=null) out.write(s);
out.write(" ");
}
out.write("
");
}
} else {
out.write("Failure");
out.write(" Code: " + rs.getErrorCode());
}
%>
Done.