getCallingPackage alternative


Does any one know of a method which will do the same functionality as that of getCallingPackage in 6.1/6.5? I want the same functionality in 8.0 but this has been deprecated.


Service A from Package x calls Service B in Package y. I would like to get the Package x name as output in the Service B in Package y.

I want to write a Util service which will return the Calling service Package name.


Hi Akshith,
if your package name and the root folder name is same, as we generally do.
You can use getCallingServiceName service of PSUtilities, and tokenize or split to get the package name from that servicename…

-Srikanth G

Yup that is the current work around we have in place but for some of the old packages the root directory is not the same as Package name.

Currently we are doing some additional logic to get the package name for them and checking inside this util if it is an old package or a new package and based on that the value will be returned.


try this tweak of getCallingServiceName service…

IDataCursor cursor = pipeline.getCursor();
Stack callStack = InvokeState.getCurrentState().getCallStack();
int size = callStack.size();
if (size > 2)
NSService callingSrv = (NSService)Namespace.current().getNode(callStack.elementAt(size - 3).toString());
IDataUtil.put(cursor, “callingPackageName”, callingSrv.getPackage().getName());

this should work for your scenario…

-Srikanth G

Cool, this is what i was looking for “callingSrv.getPackage().getName()”. You just made my day, appreciate it!