문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top