SUMMARY: There are many scenarios where the user only wants to access a report services document to retrieve the dataset objects. However, if the document being accessed contains prompts, it is not possible to bypass them without answering using an execution flag similar to reports. Nevertheless, if all the prompts on the document are optional, this is possible to be done with the Strategy Web SDK 9.4.1
The following sample code demonstrates how this is done:
private static WebIServerSession serverSession = null;
private static WebObjectsFactory factory = null;
public static void main(String[] args) {
// TODO Auto-generated method stub
factory = WebObjectsFactory.getInstance();
serverSession = factory.getIServerSession();
serverSession.setServerName("was-jpan");
serverSession.setServerPort(0);
serverSession.setProjectName("Strategy Tutorial");
serverSession.setLogin("administrator"); // UserID
serverSession.setPassword(""); // Password
System.out.println(serverSession.saveState());
// Initialize the session with the above parameters
String docid = "BC8C829A4700640A27AF73802B333050";
RWSource documentSource = factory.getRWSource();
try {
RWInstance rwi = documentSource.getNewInstance(docid);
rwi.setAsync(false);
//Bypass all option prompts using the answerPrompts method
rwi.getPrompts().answerPrompts();
rwi.pollStatus();
RWDefinition rwd = rwi.getDefinition();
RWDataSet dataset = null;
for (int i = 0; i < rwd.getDataSets().size(); i++) {
dataset = rwd.getDataSets().get(i);
WebObjectInfo woi = dataset.getSourceObject();
System.out.println("Dataset: " + woi.getDisplayName());
System.out.println("Dataset ID: " + woi.getID());
System.out.println("Dataset Type: " + woi.getType());
}
} catch (Exception e) {
// TODO: handle exception
}
}