Andrew Andrew - 1 year ago 145
Java Question

Deploy report to JasperServer via SOAP API

I am looking for an example on deploying a report unit to JasperServer using it's SOAP Services, preferably with a java client.

Answer Source

I found a way to do that with JasperServer WebServices (Set of SOAP services for managing server and data on it).

So ... the unit of data used to communicate with the server is com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor... which represents a resource... implementation of client is the following com.jaspersoft.jasperserver.irplugin.wsclient.WSClient...

to make it a bit clearer here is the code :

public void publishImage() throws Exception {

    ResourceDescriptor rd = new ResourceDescriptor();       
    rd.setLabel("Coffee picture from java");
    rd.setUriString(rd.getParentFolder() + rd.getName());

    File image = new File("/home/coffee.jpg");

    client.addOrModifyResource(rd, image);

The code above shows how to upload an image to the server, to deploy a report you will need to create separate ResourceDescriptors for .jrxml file and datasource if any...


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download