Jasperserver Web Services call to runReport - What libraries?

Hi all,

I'm using iReport and JasperServer Pro 4.7, and am wanting to call the runReport method on WSClient in a Java servlet.

The problem I'm having, is locating the required JARs/Libaries to run the following piece of code:

 

      JServer js = new JServer();
      js.setUrl(serverUrl);
      js.setUsername(serverUser);
      js.setPassword(serverPassword);

      ResourceDescriptor rd = new ResourceDescriptor();
      rd.setWsType(ResourceDescriptor.TYPE_JRXML);
      rd.setUriString("/Projects/Report1");

      Map params = new HashMap();
      params.put("param1", "1234");

      WSClient client = new WSClient(js);
      JasperPrint jasperPrint = client.runReport(rd, params);

 

I've attached the following libraries to my Java application:

com-jaspersoft-ireport-jasperserver.jar
js_activation-1.1.jar
js_axis-1.4patched.jar
js_commons-codec-1.3.jar
js_commons-discovery-0.2.jar
js_commons-httpclient-3.1.jar
js_jasperserver-common-ws-3.5.0.jar
js_jaxrpc.jar
js_mail-1.4.jar
js_saaj-api-1.3.jar
js_wsdl4j-1.5.1.jar

 

What library do I need to use the JasperPrint object? I've tried using jasperreports-4.7.jar, however at runtime, I'm getting dependency exceptions for "java.lang.NoClassDefFoundError: com/jaspersoft/ireport/designer/IReportManager"

The Web Services documentation is very thin on details.

 

Any help would be great.

Cheers,
Chris

 

chris.noonan's picture
Joined: Oct 5 2012 - 12:34am
Last seen: 9 years 7 months ago

1 Answer:

Chris,

There is a sample with the JasperServer Distribution on using the API you will find it in <js-install-path>/samples/java-webapp-sample/ you will find a working sample there and also the WSClient.java class is there. Remember that you will be using the Server API (either SOAP or REST) so you will not need the Jasper Library in your application.

The also the Jersey library is really good if you are using the REST API http://www.mkyong.com/webservices/jax-rs/restful-java-client-with-jersey-client/

This link may be able to help you also, it looks a bit old but it should give you some guidance: http://www.jaspersoft.com/sites/default/files/downloads/Jaspersoft-api-wp.pdf and of course the Web Services Guide http://community.jaspersoft.com/sites/default/files/docs/jasperreports-server-web-services-guide.pdf

 

Mariano

marianol's picture
17628
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 11 months ago
Hi Mariano, Thanks for the assistance. The WSClient.java class references the following imports: import net.sf.jasperreports.engine.JasperPrint; import com.jaspersoft.jasperserver.irplugin.JServer; import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.*; Which libraries/jars do I need to complete these imports? Regards, Chris
chris.noonan - 10 years 11 months ago
I can get it working using the Jersey library, however the performance is quite terrible. I can build the report faster using the JasperReport Library engine. Hence the reason for wanting to use the SOAP api's.
chris.noonan - 10 years 11 months ago
Feedback