I need to know how to do 2 things within a service.
extract the current package name of the current service.
extract the full Namespace of the current service.
Thanks
Bert
I need to know how to do 2 things within a service.
extract the current package name of the current service.
extract the full Namespace of the current service.
Thanks
Bert
Try using Service.getServiceEntry()
HTH…
Saurabh.
IDataHashCursor curs = pipeline.getHashCursor();
String caller = “”;
try
{
Thread t = Thread.currentThread();
com.wm.app.b2b.server.ServerThread st = (com.wm.app.b2b.server.ServerThread)t;
java.util.Stack stack = st.getState().getCallStack();
caller += stack.elementAt(0).toString();
Bert, you can use the webMethods API to get this information. I don’t have it in front of me right now, but you can look at the API from the Developer tool.
Go to “Help > webMethods API” and look at the ServiceAPI class. There is a method called getCallingPackage and another method (whose name escapes me right now…) called something like getService. Reading the API, it will be clear what each method does. However, I am assuming that you are comfortable enough with Java to read an API. If not, just speak up and we can get some code posted here for you.
For curiousity’s sake, what is your business problem?
To correct my prior post:
getCallingService() – a member of the com.wm.app.b2b.server.Service class. Returns the service that invoked the service from which getCallingService is being executed.
getPackageName() – a member of the com.wm.app.b2b.server.Service class. Returns the name of the current package directory.
Thanks.
how can I use getCallingService() to display the calling service in a variable called serviceName?
Here you are (at v4.6):
String serviceName = null;
NSService myService = (NSService) Service.getCallingService();
serviceName = myService.getNSName().getFullName();
// pipeline out
IDataCursor pipelineCursor = pipeline.getCursor();
IDataUtil.put(pipelineCursor, “serviceName”, serviceName);
pipelineCursor.destroy();
import com.wm.app.b2b.server.Service
import com.wm.lang.ns.NSService