views:

29

answers:

1

Can someone provide me any examples on deploying a report unit to JasperServer using it's SOAP Services?

Thanks in advance!

A: 

Hello again! 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 Dacom.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.setName("coffeepicture");
    rd.setLabel("Coffee picture from java");
    rd.setResourceType(ResourceDescriptor.TYPE_IMAGE);
    rd.setMainReport(true);
    rd.setParentFolder("/Samples");
    rd.setUriString(rd.getParentFolder() + rd.getName());
    rd.setWsType(ResourceDescriptor.TYPE_IMAGE);
    rd.setIsNew(true);
    rd.setHasData(true);

    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...

Regards!

Andrew