Focal Point
[CLOSED] Report Caster API

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4707078076

May 26, 2014, 09:59 AM
Rakesh Boddu
[CLOSED] Report Caster API
Hi Guys,

I am using Report Caster API to develop JAVA application to customize scheduling window.


I went though Report Caster documents,but could not solve my issues.

I am using Eclipse IDE to develop Java Application.

Can any one guide me how to run sample programs from Eclipse IDE,what are the environmental variables i should change?

Trying to achieve this from past one week.Help me to figure out this.

Thanks in advance.
Rakesh

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.0.03
Windows, All Outputs
May 27, 2014, 04:24 AM
linnex
Hi Rakesh,

I am not 100% sure if I understood you problem correctly. Do you need help running example Java Apps from Eclipse? Or do you need help accessing the RCaster API from Java.
For using Eclipse I would suggest looking into a different forum.
For accessing the Report Caster API using Java (independent of which IDE or none at all you use) - maybe the following first example helps to create at least a connection to your ReportCaster service:

import ibi.broker.api.CasterManagedConnectionFactory;
import ibi.broker.api.cci.CasterConnection;
import ibi.broker.api.cci.CasterConnectionFactory;
import ibi.broker.api.cci.PasswordCredential;
import ibi.broker.api.cci.SecurityTokenCredential;

import java.util.ResourceBundle;

import javax.resource.cci.ConnectionSpec;

public class PseudoConnectToRCaster {
	
	public static CasterConnection createCasterConnection() throws Exception {
		String host = "localhost";
		String port = "8200";
		String user = "admin";
		String password = "";
		String token = "";

		CasterManagedConnectionFactory managedConnectionFactory = new CasterManagedConnectionFactory();

		managedConnectionFactory.setServerName(host);
		managedConnectionFactory.setPortNumber(port);

		CasterConnectionFactory connectionFactory = (CasterConnectionFactory) managedConnectionFactory
				.createConnectionFactory();
		ConnectionSpec credential;
		if (token == "" || token == null) {
			credential = new PasswordCredential(user, password.toCharArray());
		} else {
			// System.out.println("Token: " + token);
			credential = new SecurityTokenCredential(token);
		}

		CasterConnection cc = ((CasterConnection) connectionFactory.getConnection(credential));
 		// System.out.println("User: " + cc.getUser().getName());
		return cc;
	}
}


(In Eclipse: make sure you have added your reportcaster.jar etc. to your Build-Path, in java itself it must be added to the classpath env var)

You need to fill in host, port etc. yourself of course or change the function to provide them as parameters. If the RCaster runs on a different server it must also be accessible (Firewall, Port etc.).

Using the CasterConnection object returned by my ex. function you can than retrieve further objects from the API or perform methods (e.g. getLibraryContentManager() for access on all already existing reports in the library).

Hope this points in the right direction and helps

Cheers Linne


WebFOCUS 7.7.03
May 27, 2014, 06:31 AM
Rakesh Boddu
Hi Linne,

First of all thanks for your very quick response.

I tried your above code,but having same error which i am facing earlier.

ERROR! License has not been loaded. Exception has been thrown while trying to read the file:null/wflicense.key


import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQuery; Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform


I included all the API jars in BUILD PATH of my eclipse.


I am missing something,can you help me figure out.

Atleast want to create connection to my Report Caster Service.

Thanks,
Rakesh


WebFOCUS 8.0.03
Windows, All Outputs
May 27, 2014, 08:22 AM
linnex
Hi Rakesh,

sorry, but I will be guessing here now because I have not experienced this exception yet. It could also be that this is related to WebFOCUS 8.0.x you are using while I am still on WF 7.7.x

One Thing you could try (as it it also mentioned at the end of the exception error msg): add the right jdbc driver jar to your CLASSPATH.
If your WF runs on an Oracle DB this should be ojdbc6.jar or similar, for MS SQL: sqljdbc4.jar. You might Need to download them from the resp. DB vendor but they are generally free.

Hope this helps

Cheers Linne


WebFOCUS 7.7.03
May 27, 2014, 10:53 AM
Rakesh Boddu
Thanks Linne.

I included ojdbc6.jar file also in my Java Build Path of ECLIPSE environment.

But facing still error.

Thanks,
rakesh


WebFOCUS 8.0.03
Windows, All Outputs
June 02, 2014, 09:13 AM
linnex
Hi Rakesh,

I am out of ideas unfortunately.
I can only suggest opening a case with IBI.
They helps us getting the "first contact" with our WebFOCUS RCaster via the API. I believe they will also be able to help you out here.

Cheers
Linne


WebFOCUS 7.7.03