Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Executing a RFC within a Portal Service

Hello All:

I'm trying to execute a RFC during the afterInit() function of my custom portal service. I've gotten the

call to work properly in an AbstractPortalComponent. However my problem is that when I put it in a service,

I don't have access to the request object and therefore I don't have an authenticated user for the

ConnectionProperties constructor.

IConnection con = null;
try {
	Object tempCon = PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
	IConnectorGatewayService cgService = (IConnectorGatewayService) tempCon;
	ConnectionProperties prop = new ConnectionProperties(local,user);
	con = cgService.getConnection(connectionString, prop);
} catch (Exception ex) {
	ex.printStackTrace(System.err);
}

In the portal Service, I create my own IUser object:

IUserFactory userFactory = UMFactory.getUserFactory();
IUser user = userFactory.getUserByLogonID("myuserid");

and pass that user to the ConnectionProperties Constructor, but the getConnection() fails. Is there

some service user I can use? Or is there a way that I can force the IUser object in the service to be

authenticated (I would know the password).

Thanks

Not what you were looking for? View more on this topic or Ask a question