Thanks, Everyone for your responses!
Percio,
I ended up combining the results of the posts that you found and created this “getContextID” java service (code below). It may require some refining, but it gets us what we want.
Here are the steps I took:
- create the java service “getContextID” (code below)
- call the “getContextID” service from the flow service(s) for which I need to identify the contextID. The “parent” or “root” is the value that I want. The “contextID” is the contextID of the instance of the “getContextID” service.
String[] contextStack;
String contextID = "";
String parentID = "";
String rootID = "";
try{
contextStack = InvokeState.getCurrentState().getAuditRuntime().getContextStack();
if (contextStack.length >= 5){
rootID = contextStack[0];
parentID = contextStack[2];
contextID = contextStack[3];
}
else if (contextStack.length >= 2){
contextID = contextStack[0];
parentID = contextStack[1];
rootID = contextStack[contextStack.length - 1]; }
else if (contextStack.length == 1) {
contextID = contextStack[0];
}
}
catch(Exception ex){
ServiceException sx = new ServiceException(ex);
throw sx;
}
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put(pipelineCursor_1, "contextID", contextID);
IDataUtil.put(pipelineCursor_1, "parentID", parentID);
IDataUtil.put(pipelineCursor_1, "rootID", rootID);
pipelineCursor_1.destroy();
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods