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
Expand all | Collapse all

doInvoke service throwing Null pointer exception

  • 1.  doInvoke service throwing Null pointer exception

    Posted Sun June 12, 2016 04:45 PM

    Hi,
    I am trying to invoke a service inside a thread class. But it is throwing “java.lang.nullpointerException” when doing so. When I try to invoke it without any thread implementation then it is working fine. But if i use thread implementation its throwing an exception.

    Sample Code:

    IDataCursor pipelineCursor = pipeline.getCursor();
    try
    {
    FPImpServiceN m1=new FPImpServiceN();
    Thread t1 =new Thread(m1);
    t1.start();

    }
    catch(Exception e)
    {
    throw new ServiceException(e);
    }
    pipelineCursor.destroy();

    Code in source:

    static class FPImpServiceN implements Runnable
    {
    public void run()
    {
    try
    {
    NSName nsName = NSName.create( “threadsPOC.services:new_javaService” );
    IData outputData = Service.doInvoke( nsName, null );
    }
    catch(Exception e)
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, e);
    }
    }
    }

    Please let me know how i can I invoke a service inside thread class.


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


  • 2.  RE: doInvoke service throwing Null pointer exception

    Posted Tue June 14, 2016 12:44 PM

    Which line of the code is the exception pointing to?

    Now, if all you want is to execute a service in a separate thread, you could/should use Service.doThreadInvoke instead of creating your own thread. Easier and simpler.

    Percio


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


  • 3.  RE: doInvoke service throwing Null pointer exception

    Posted Tue June 14, 2016 02:57 PM

    Hi Castro,

    Thanks for the reply. I am getting the exception at the following line.

    IData outputData = Service.doInvoke( nsName, null );

    My requirement is to kill the thread when the service which is invoked by doInvoke() function takes long time to run than the specified timeout. This doInvoke() function resides inside a thread class. So killing thread will kill the execution of the service.

    If I use doThreadInvoke() function then that thread continues to run in the background even though the main service exists.


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


  • 4.  RE: doInvoke service throwing Null pointer exception

    Posted Tue June 14, 2016 04:01 PM

    Have you tried passing it an empty pipeline instead of null?


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


  • 5.  RE: doInvoke service throwing Null pointer exception

    Posted Tue June 14, 2016 04:06 PM

    Hi Castro,

    yes i tried.

    IData inputData = IDataFactory.create();
    NSName nsName = NSName.create( “threadsPOC.services:new_javaService” );
    IData outputData = Service.doInvoke( nsName, inputData );

    getting same exception.


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


  • 6.  RE: doInvoke service throwing Null pointer exception

    Posted Wed June 15, 2016 01:18 PM

    try
    {
    Service.doInvoke(ifc, svc, pipe);
    }
    catch(Exception e)
    {
    throw new ServiceException(e);
    }

    However we have a service in 9.0 and above, WmPublic - pub.flow:invokeService which uses Service.doInvoke. See if that will suffice your need.


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


  • 7.  RE: doInvoke service throwing Null pointer exception

    Posted Wed June 15, 2016 03:19 PM

    Getting same error Mahesh. By the way I am using 8.2 version. Thanks for the reply.


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


  • 8.  RE: doInvoke service throwing Null pointer exception

    Posted Wed June 15, 2016 08:18 PM

    If the code works fine when executed on the “main” thread but fails when executed on a new thread, then I assume that there is some thread local variable which is present on the main thread but lacks on your custom thread. Like session or something like that.

    And: Killing a thread in Java is not a simple thing. The thread must cooperate for it to happen cleanly. So, as Percio Castro said, I’d use doThreadInvoke if only possible.


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


  • 9.  RE: doInvoke service throwing Null pointer exception

    Posted Sat June 18, 2016 06:54 AM

    Hi fml2,

    I think you are correct. I resolved this problem by using the follow solution in thread class.

                        NSName nsName = NSName.create( "threadsPOC.services:new_javaService" );
    com.wm.app.b2b.server.User user =   com.wm.app.b2b.server.UserManager.getUser("Administrator");
    Session s = StateManager.createContext(0x7fffffffL, "system", user);
    s.setUser(user);
    s.clearModified(); 
    NSName nsName = NSName.create(serviceName); 
    outputData = s.invoke(user, nsName, null );
    StateManager.deleteContext(s.getSessionID());
    

    The service which i wanted to invoke from thread class got invoked successfully.

    But this implementation doesn’t working as per my requirement. The service which I invoked from thread class is running in the background even after killing the thread.

    The service should also stop when I kill the thread but it is not happening so. Can you please help me how I can stop the service from executing.


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


  • 10.  RE: doInvoke service throwing Null pointer exception

    Posted Sun June 19, 2016 01:24 PM

    Hello,

    where did you get all those classes and methods from? I don’t know them.

    How do you kill the thread? To my knowledge, killing a thread is not a simple thing. The java method executed on the thread should be programmed in a “cooperative” way and be ready for thread termination (and should exit then). You can call some java method to terminate the thread, but if the thread method is not programmed properly it will have no effect. This is the way I understand it.


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


  • 11.  RE: doInvoke service throwing Null pointer exception

    Posted Sun June 19, 2016 04:47 PM

    Hi fml2,

    Thanks for the reply. Those methods are present in

    import com.wm.app.b2b.server.Session;
    import com.wm.app.b2b.server.StateManager;

    Regarding the approach i am using for killing the thread please go through the following code.

    Main code:

    IDataCursor pipelineCursor = pipeline.getCursor();
    try
    {
    long timeout = 10000;
    String serviceName = “threadsPOC.services:new_javaService”;
    int i=0, startTimer=0;
    FilePullImpService m1=new FilePullImpService(serviceName);

    		Thread t1 =new Thread(m1);
    while(true)
    {				
    if(i==0)
    {
    i++;
    t1.start(); /* Invoking the thread class*/
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Thread Class Started");			
    }
    else if(startTimer < timeout)
    {
    IData status = m1.returnval(); /*check If Thread completed execution. If completed then status will not be null*/
    if(status != null)
    {
    IDataUtil.put( pipelineCursor, "output", status );
    break;
    }
    else
    {
    startTimer +=1000;
    t1.join(1000); /* wait for 1000 milli seconds for thread to get completed */
    System.out.println(startTimer);
    }					
    }
    else /*If timeout exceeded and thread failed to complete */
    {	
    System.out.println("Thread Faied To Complete Before Timeout");
    System.out.println("Status Of Thread Before Killing " + t1.getState());
    t1.stop(); /* Stop the thread */
    System.out.println("Status Of Thread After Killing " + t1.getState());
    IDataUtil.put( pipelineCursor, "output", null );
    break;
    }
    }
    }
    catch(Exception e)
    {
    throw new ServiceException(e);
    }
    pipelineCursor.destroy();
    

    Code in Source Area:

    static class FilePullImpService extends Thread
    {
    String serviceName;
    IData outputData = null;
    Session s = null;
    FilePullImpService(String serviceName)
    {
    this.serviceName = serviceName;

    	}
    public void run()
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Inside Thread Class");
    try
    {
    com.wm.app.b2b.server.User user = com.wm.app.b2b.server.UserManager.getUser("Administrator");
    Session s = StateManager.createContext(0x7fffffffL, "System", user);
    s.setUser(user);
    s.clearModified(); 
    NSName nsName = NSName.create(serviceName); /* Invokes The flow/Java service for execution */				
    outputData = s.invoke(user, nsName, null );
    StateManager.deleteContext(s.getSessionID());
    }	
    catch(ThreadDeath e)
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Caught Thread Death Exception"); 
    }
    catch(Exception e)
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Exception Caught In Thread Class"); 
    }
    
    }
    public IData returnval()
    {
    return outputData;
    }
    }
    

    After Killing The thread i can able to see the server log “Caught Thread Death Exception”. But still the service which invoked through thread class continues to run in the background. I want to stop its execution when the thread got killed using t1.stop(). Please let me know if any suggestions or help for achieving this ?

    Thanks,
    vinodkumar


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


  • 12.  RE: doInvoke service throwing Null pointer exception

    Posted Sun June 19, 2016 04:50 PM

    apologies small correction.

    outputData = s.invoke(user, nsName, null ); /* Invokes The flow/Java service for execution */.

    The above statement invokes the required flow or java service.


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


  • 13.  RE: doInvoke service throwing Null pointer exception

    Posted Sun June 19, 2016 08:04 PM

    From the JavaDoc for ThreadDeath: “If ThreadDeath is caught by a method, it is important that it be rethrown so that the thread actually dies.”. Your code does not rethrow it.


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


  • 14.  RE: doInvoke service throwing Null pointer exception

    Posted Mon June 20, 2016 02:15 AM

    Thanks for the reply fml2.

    I have included the re-throw exception logic. Tough luck same thing happening again i.e the service which was invoked by thread class still running in the back ground even after the thread got killed.

    catch(ThreadDeath e)
    {
    throw e;
    }

    Even If I don’t include the re-throw logic the status of the thread showing as terminated after I use t1.stop(). Please find the screen shot. Please let me know if you have any suggestions. All my one week effort got vein.


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


  • 15.  RE: doInvoke service throwing Null pointer exception

    Posted Mon June 20, 2016 04:20 AM

    No, I don’t have any further suggestions without diving deep into it myself.

    How do you know the service is still running?


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


  • 16.  RE: doInvoke service throwing Null pointer exception

    Posted Mon June 20, 2016 05:58 AM

    Hi fml2,

    In the screen shot which I have shared there is a message called “bye” at the end. If the invoked service runs completely then this log message will be displayed which conveys that the service still continues to run even the thread got killed.

    Thanks,
    vinodkumar.


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


  • 17.  RE: doInvoke service throwing Null pointer exception

    Posted Mon June 20, 2016 06:43 PM

    Vinod,

    You realize Thread.stop() is deprecated. It has been deprecated for a long while. Perhaps we should talk about your use case a little bit to understand the requirements. There should be a simpler solution.

    Having said this, if you must go down this path and you’re going to use undocumented API’s anyway, then how about you just mimic the same thing that the IS does when Service.doThreadInvoke is called? You will learn that, internally, the API returns a thread ID that you should then be able to use to kill the thread via existing API’s (e.g. WmRoot’s wm.server.query:killThread and wm.server.query:interruptThread).

    Percio


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


  • 18.  RE: doInvoke service throwing Null pointer exception

    Posted Tue June 21, 2016 03:35 PM

    Hi Castro,

    Thanks for the reply. Coming to my requirement,

    1. A Main Flow service will invoke the child service and starts the timer.
    2. The child service can be anything. It can be a service which will connect to a FTP server and then pull the files from server.
    3. If the timer equals to timeout (The maximum time for the child service to complete) then it has to terminate the child service to execute further even though the child service is in middle of pulling the files from server.

    Please let me know if you want to further details about the requirement.

    IData results = null;
    com.wm.app.b2b.server.ServiceThread svcThread =Service.doThreadInvoke(“VINODPOC.services”,“javaService_A”,results);

    Please let me know how to get the Thread id from this.


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


  • 19.  RE: doInvoke service throwing Null pointer exception

    Posted Thu June 23, 2016 03:16 PM

    Hi Castro,

    By any chance can you please help me getting the thread ID from doThreadInvoke() service and killing it with WM Root services.

    Thanks,
    vinodkumar.


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


  • 20.  RE: doInvoke service throwing Null pointer exception

    Posted Thu June 23, 2016 06:11 PM

    First, I’ll say that I’m not sure you should be pursuing this solution. In 13+ years of working with webMethods, I haven’t had to programatically kill a thread. If we take the example that you provided, the pub.client:ftp and pub.client:login services come with a timeout parameter that should be used for this exact purpose. If you kill the thread, you may be left with a partially transferred file, an open connection, etc.

    For the sake of discussion though, let’s entertain the idea. Behind the scenes, Service.doThreadInvoke works more or less by doing this:

    ServiceThread thread = new ServiceThread(nsName, InvokeState.getCurrentSession(), input);
    ThreadManager.runTarget(thread, time);

    The runTarget method returns an ID. So you could save that ID and then call ThreadManager.interrupt(id) to attempt to interrupt the thread. However, this will not necessarily stop the thread (e.g. if your thread is stuck in a REPEAT loop or any code, for that matter, which is not checking the isInterrupted() flag.)

    For that situation, your best bet may be to call WmRoot/wm.server.query:getThreadList, find the thread that you’re interested in killing, and then call WmRoot/wm.server.query:interruptThread and/or killThread. This mimics killing a thread from the Server > Statistics > System Threads page. The challenge here though is finding the exact thread to be killed since you could have multiple threads for the same service running. One way would be to look at the startedat date.

    Percio


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


  • 21.  RE: doInvoke service throwing Null pointer exception

    Posted Fri June 24, 2016 04:50 PM

    Hi Castro,

    Thanks for the solution. It worked finally :o

    code:

    String serviceName = “threadsPOC.services:new_javaService”;
    NSName nsName = NSName.create(serviceName);
    ServiceThread thread = new ServiceThread(nsName, InvokeState.getCurrentSession(), null);
    String id = ThreadManager.runTarget(thread);
    ThreadManager.interrupt(id);
    IDataUtil.put(pipelineCursor, “ThreadID”, id );

    Actually we are not having any control over the child service (The service which contains pub.client:ftp and pub.client:login services). We should just invoke the child service ( need not to pass any inputs also) and wait for the status ( file transfer successful/failed etc.) returned from the child service. So the main service starts the timer after invoking the child service and checks periodically for status returned from child service. If status is not returned even after the timeout then we should kill the thread which is executing the child service. I believe now you understood the whole requirement. Also the thread ID returned from above service is something like “c0a8f40100003ac90000045e”. When I call the WmRoot/killThread it is throwing “java.lang.NumberFormatException” exception. Please suggest me If I am doing anything wrong anywhere. Thanks once again for the help.

    Thanks,
    vinodkumar.


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


  • 22.  RE: doInvoke service throwing Null pointer exception

    Posted Fri June 24, 2016 05:51 PM

    Unfortunately, the thread ID returned by runTarget is not the same as the thread ID expected by the killThread service. I was originally under the impression that they would be the same, but they are not. Hence, in my last post I suggested that you would have to call getThreadList first before calling interruptThread/killThread.

    Percio


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


  • 23.  RE: doInvoke service throwing Null pointer exception

    Posted Sat June 25, 2016 06:23 PM

    Vinod,

    I’ve thought about it a little more and now I think that the only option to really forcedly kill the thread is to use a JVM where java threads are implemented as OS threads, and then use some OS API to kill the thread. But that may leave the JVM in a very instable state since you’d pull the thread off under its feet.

    Let me elaborate. Even if ouy find out how to use the ThreadManager API etc, the most it can is to call “interrupt” on some java.lang.Thread object. I think, in the end it comes to this class, I don’t think SAG has implemented the thread concept natively - why use java then?

    A java thread must be programmed in an appropriate way to be interruptible. I.e. it should check some variable or its “interrupted” status to see whether it should terminate. And this kind of programming must be everywhere, i.e. in all actions performed on the thread.

    Now, which code is executed in an IS thread? Mostly it will be flow or java services. Flow services are interpreted, so SAG might have implemented the interpreter so that it checks (e.g. after having executed a flow step) whether it should stop. But honestly, I doubt the did it that way.

    And if you have a java service, then it also should be programmed that way. ALL java services must programmed that way. And I’m sure it’s not the case.

    Hence you can’t stop the thread with native java means. And hence the only option would be to use the OS API which is beyond java.

    Or you could find a java implementation which would stop a thread when it’s interrupted.


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


  • 24.  RE: doInvoke service throwing Null pointer exception

    Posted Mon July 04, 2016 03:05 PM

    Hi castro,

    As you said ThreadManager.interrupt(id) will attempt to interrupt the thread. However, this will not necessarily stop the thread (e.g. if your thread is stuck in a REPEAT loop or any code, for that matter, which is not checking the isInterrupted() flag.).

    But what we need to do if we want to forcefully kill the thread ? will that be possible ? Also I have a query. What is the expected input to “wm.server.query:ikillThread” service. I used the thread ID which I got from “WmRoot/wm.server.query:getThreadList”. killThread service always throwing an exception saying invalid threadID.

    Thanks,
    vinodkumar.


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


  • 25.  RE: doInvoke service throwing Null pointer exception

    Posted Tue July 05, 2016 02:45 PM

    Hi Castro,

    Did u get a chance to look at my message. Please let me know if you have some suggestion/solution.

    Thanks,
    vinodkumar.


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


  • 26.  RE: doInvoke service throwing Null pointer exception

    Posted Sun July 10, 2016 02:35 PM

    Hi Guys,

    I think I found a solution for killing a service even if it got stuck in an infinite loop etc. Please find the following solution for this. Basically the main program will have 2 inputs service name and timeout value after which you want to kill the service for further execution. Sub program will have service name as input.

    Main Program:

    package threadsPOC.latestImplementation;

    import com.wm.data.*;
    import com.wm.util.Values;
    import com.wm.app.b2b.server.Service;
    import com.wm.app.b2b.server.ServiceException;
    import com.wm.lang.ns.NSName;
    import com.wm.app.b2b.server.ServiceThread;
    import com.wm.app.b2b.server.InvokeState;
    import com.wm.app.b2b.server.ThreadManager;

    public final class invokeFilePullingImpService_SVC

    {

    /** 
    * The primary method for the Java service
    *
    * @param pipeline
    *            The IData pipeline
    * @throws ServiceException
    */
    public static final void invokeFilePullingImpService(IData pipeline)
    throws ServiceException {
    
    IDataCursor pipelineCursor = pipeline.getCursor();
    try
    {
    String serviceName = "threadsPOC.services:xyz";
    long timeout = 20000;
    
    int startTimer=0;
    IData status = null;
    IData threadDetails;
    IDataCursor threadCursor;
    IData interruptThreadDet;
    IDataCursor interruptThreadCursor;
    
    FilePullImpService m1=new FilePullImpService(serviceName);
    Thread t1 =new Thread(m1);
    
    t1.start();
    long threadID = t1.getId();
    System.out.println("ThreadID ---> " +threadID);
    
    while(true)
    {
    if(startTimer < timeout)
    {
    status = m1.returnval();
    
    if(status != null)
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Recieved Result From Thread Class");
    IDataUtil.put( pipelineCursor, "status", status );
    break;
    }
    else
    {
    startTimer +=1000;
    t1.join(1000);
    System.out.println("Timer " +startTimer);
    }					
    }
    else
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Thread Faied To Complete Before Timeout");
    System.out.println("Status Of Thread Before Killing " + t1.getState());
    
    m1.killService();
    Thread.sleep(1000);
    System.out.println("Status Of Thread After Killing " + t1.getState());
    if(t1.getState().toString().equals("TERMINATED"))
    {
    System.out.println("Thread Got Killed ");
    break;
    }
    threadDetails = IDataFactory.create();
    threadCursor = threadDetails.getCursor();
    IDataUtil.put(threadCursor, "threadID", threadID);
    threadCursor.destroy();
    System.out.println(threadDetails);
    
    NSName nsName = NSName.create("wm.server.query:getThreadDumpForThread");
    IData threadDumpIData = Service.doInvoke(nsName, threadDetails);
    
    IDataCursor threadDumpCursor = threadDumpIData.getCursor();
    String threadDump = IDataUtil.getString(threadDumpCursor,"threadDump");
    
    threadDump = threadDump.replace("\n", " ");
    int iniIndex = threadDump.indexOf("Id=");
    int actIndex = threadDump.indexOf("Id=", iniIndex+3);
    int spaceIndex = threadDump.indexOf(" ", actIndex+3);
    String threadIDNew = threadDump.substring(actIndex+3,spaceIndex).trim();
    
    System.out.println("threadDump " +threadDump);
    System.out.println("threadID " +threadIDNew);
    
    interruptThreadDet = IDataFactory.create();
    interruptThreadCursor = interruptThreadDet.getCursor();
    IDataUtil.put(interruptThreadCursor, "threadID", threadIDNew);
    interruptThreadCursor.destroy();
    
    System.out.println(interruptThreadDet);
    NSName nsNameInt = NSName.create("wm.server.query:interruptThread");
    Service.doInvoke(nsNameInt, interruptThreadDet);
    
    
    Thread.sleep(1000);
    System.out.println("Status Of Thread After Killing " + t1.getState());
    
    break;
    
    }
    }
    }
    catch(Exception e)
    {
    throw new ServiceException(e);
    }
    pipelineCursor.destroy();
    }
    
    // --- <<IS-BEGIN-SHARED-SOURCE-AREA>> ---
    
    static class FilePullImpService extends Thread
    {
    IData serviceDetails;
    IDataCursor outputCursor;
    IData outputData = null;
    String thrId = null;
    FilePullImpService(String serviceName)
    {
    serviceDetails = IDataFactory.create();
    outputCursor = serviceDetails.getCursor();
    IDataUtil.put(outputCursor, "serviceName", serviceName);
    outputCursor.destroy();
    
    }
    public void run()
    {
    try
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Thread Class Started");
    NSName nsName = NSName.create("threadsPOC.latestImplementation:doInvokeService");
    ServiceThread thread = new ServiceThread(nsName, InvokeState.getCurrentSession(), serviceDetails);
    thrId = ThreadManager.runTarget(thread);
    outputData = thread.getIData();
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Thread Class Completed");
    }
    catch(Exception e)
    {
    System.out.println(e);
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, "Exception Caught In Thread Class"); 
    
    }
    
    }
    public IData returnval()
    {
    return outputData;
    }
    public void killService()
    {
    System.out.println("Killing Service In Thread Class");
    ThreadManager.interrupt(thrId);
    }
    }
    
    // --- <<IS-END-SHARED-SOURCE-AREA>> ---
    

    }

    Sub Program:

    public static final void doInvokeService(IData pipeline)
    throws ServiceException {

    	try
    {
    IDataCursor pipelineCursor = pipeline.getCursor(); 
    String serviceName = IDataUtil.getString(pipelineCursor,"serviceName");
    NSName nsName = NSName.create(serviceName); 
    IData outputData = Service.doInvoke(nsName, null); 
    IDataUtil.put( pipelineCursor,"result",outputData);
    pipelineCursor.destroy();
    }
    catch(Exception e)
    {
    throw new ServiceException(e);
    }
    }
    

    Please analyse the program and let me know if you guys have any queries. Thanks to Castro for the help.

    Thanks,
    vinodkumar.


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