This uses unpublished methods so may break in future versions. Use at your own risk.
[highlight=java]getServiceStack(IData pipeline)
{
IDataCursor idc = pipeline.getCursor();
java.util.Stack callStack = com.wm.app.b2b.server.InvokeState.getCurrentState().getCallStack();
// Note that we allocated one less than what the stack has
// to omit this service from being in the list
String[] serviceStack = new String[callStack.size()-1];
for(int j=0,i=serviceStack.length; --i>=0;j++)
serviceStack[j] = ((com.wm.lang.ns.NSService)callStack.elementAt(i)).toString();
IDataUtil.put(idc, "serviceStack", serviceStack);
idc.destroy();
}[/highlight]
This reverses the order of the stack. Depending on your preference, you might want to change the for loop to keep the order as returned by getCallStack.
HTH
#Flow-and-Java-services#webMethods#Integration-Server-and-ESB