webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Flow Service - Capturing Context ID

    Posted Wed June 13, 2007 09:22 PM

    Hello,

    I would like to capture the Context ID that is assigned to the instance when the flow service is invoked. I can see this value in the wm portal/ integration monitoring.

    How do I capture this value from within the flow service?

    Thanks!


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: Flow Service - Capturing Context ID

    Posted Wed June 13, 2007 10:16 PM

    Look in the webMethods JavaAPI doc or browse in WmRoot services for available functions for capturing the ContextID.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: Flow Service - Capturing Context ID

    Posted Fri June 15, 2007 03:16 PM

    RMG,

    Can you be a little more specific? I’m also looking for a way to capture the Context ID. I looked through the WmPublic and WmRoot services, and I looked throught the public Java API but I couldn’t find anything.

    Thanks,
    Percio


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Flow Service - Capturing Context ID

    Posted Fri June 15, 2007 04:01 PM

    perhaps you should use the “search” button in wMUsers :wink:

    [url]wmusers.com


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: Flow Service - Capturing Context ID

    Posted Fri June 15, 2007 04:37 PM

    ArnaudW,

    Thanks for the suggestion, but the solution proposed in the thread you provided appears to be incomplete or out-dated.

    nerdgirl,

    I searched Advantage and I found a KB article that appears to have the solution to what we need. The drawback is that the solution relies on methods which are not publicly documented. Here’s the link: [URL=“https://advantage.webmethods.com/advantage?targChanId=kb_home&oid=1612149252”]https://advantage.webmethods.com/advantage?targChanId=kb_home&oid=1612149252[/URL]

    There are also a couple of threads in the Advantage Forum that talk about this topic. Just run a search in Advantage for get context id and they should pop up.

    • Percio

    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 6.  RE: Flow Service - Capturing Context ID

    Posted Mon June 18, 2007 06:38 PM

    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:

    1. create the java service “getContextID” (code below)
    2. 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