Hi,
You can use following code to get the context id of a service:
String[] contextStack;
String currentContextID = "";
String currentParentID = "";
String currentRootID = "";
Stack stack=new Stack();
IDataCursor pipelineCursor_1 = pipeline.getCursor();
try{
contextStack = InvokeState.getCurrentState().getAuditRuntime().getContextStack();
if(contextStack!=null)
if(contextStack.length >=3){
currentRootID = contextStack[0];
currentParentID = contextStack[1];
currentContextID = contextStack[2];
}else if (contextStack.length>=2){
currentRootID = contextStack[0];
currentParentID = contextStack[1];
currentContextID = currentParentID;
}else if (contextStack.length>=1){
currentRootID = contextStack[0];
currentParentID = currentRootID;
currentContextID = currentRootID;
}
IDataUtil.put(pipelineCursor_1, “contextStack”, contextStack);
}catch(Exception ex){
//ServiceException sx = new ServiceException(ex);
}
// pipeline
IDataUtil.put(pipelineCursor_1, "currentContextID", currentContextID); // Assuming that caller is looking for its context ID. currentContextID extracted is the context ID for the java service, not the caller service.
IDataUtil.put(pipelineCursor_1, "currentParentID", currentParentID);
IDataUtil.put(pipelineCursor_1, “currentRootID”, currentRootID);
pipelineCursor_1.destroy();
#webMethods#webMethods-General#Integration-Server-and-ESB