import java.io.*; import javax.activation.*; import inetsoft.sree.soap.EnumFactory; import inetsoft.sree.soap.*; public class SoapClient { public SoapClient(){ } public static void main(String [] args ){ try{ SoapRepositoryStub stub = new SoapRepositoryStub(); SoapRepositoryStub.Login login = new SoapRepositoryStub.Login(); login.setArgs0("admin"); login.setArgs1("admin"); String ticket = stub.login(login).get_return(); SoapRepositoryStub.GetRepletParameters getRepletParameters = new SoapRepositoryStub.GetRepletParameters(); getRepletParameters.setArgs0(ticket); getRepletParameters.setArgs1("Production"); SoapRepositoryStub.RepletParametersStruct rps = stub.getRepletParameters(getRepletParameters).get_return(); SoapRepositoryStub.RepletRequestStruct rrs = new SoapRepositoryStub.RepletRequestStruct(); rrs.setName("create"); //get report parameters String[] paramNames = null; String[] paramValues = null; if(rps.getParametersLength() > 0 ) { paramNames = rps.getParameterNames(); paramValues = new String[paramNames.length]; System.err.println("There are " + rps.getParametersLength() + " parameters"); for(int i = 0; i < paramNames.length; i++) { System.out.print("Please input value for parameter[" + paramNames[i] + "]:"); BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); String value = buf.readLine(); paramValues[i] = value; } } //Set parameter names and values if(rps !=null){ rrs.setParamNames(paramNames); rrs.setParamValues(paramValues); } //execute a replet SoapRepositoryStub.ExecuteReplet executeReplet = new SoapRepositoryStub.ExecuteReplet(); executeReplet.setArgs0(ticket); executeReplet.setArgs1("Production"); executeReplet.setArgs2(EnumFactory.REPLET); executeReplet.setArgs3(rrs); String repletID = stub.executeReplet(executeReplet).get_return(); //export to PDF SoapRepositoryStub.Export export = new SoapRepositoryStub.Export(); export.setArgs0(ticket); export.setArgs1(repletID); export.setArgs2(EnumFactory.PDF); String exportID = stub.export(export).get_return(); //write the exported report to a file FileOutputStream output = new FileOutputStream("Production.pdf"); DataHandler handler = null; do { SoapRepositoryStub.NextBlock nextBlock = new SoapRepositoryStub.NextBlock(); nextBlock.setArgs0(ticket); nextBlock.setArgs1(exportID); handler = stub.nextBlock(nextBlock).get_return(); if(handler != null) { handler.writeTo(output); } } while(handler != null); output.flush(); output.close(); } catch (Exception e){ e.printStackTrace(); } } }