IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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

MWS Task API to retrieve TaskData in non Task Packages.

  • 1.  MWS Task API to retrieve TaskData in non Task Packages.

    Posted Mon May 16, 2011 12:18 PM

    hi All,

    We have a scenario where we have to use data present - in TaskData object of MWS Tasks in Generic portlets which are present in non Task packages.

    At present, to get TaskData, we are using getTask() method from webservice: http://host:port/services/bizPolicy/task?WSDL.

    This getTask() method returns the contents of taskdata as a HashMap and we are getting custom data as shown below:

    Hashtable taskBusinessData = this.getGetTask().getResult().getTaskData();
    Hashtable customData = (Hashtable)taskBusinessData.get("customData");
    String strValue1 = customData.get('customStrData1');
    String strValue2 = customData.get('customStrData2');

    Is there any better procedure where we can use existing MWS Task API in Generic portlets (in non Task Packages), to get TaskData?

    We tried using TaskContentProviderExtended, TaskContentProvider and ItaskPortType class, but these classess has methods to get only TaskInfo object.

    Kind regards,
    Raja sekhar Kintali


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 2.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Wed May 18, 2011 01:20 AM

    The more common practice is to have the task data operated on by business logic contained in the Task Web Application. No other application will have access to the custom task data java classes.

    However, you can directly invoke the web service support using in-proc apis shown in the following example.

    Hope this helps.
    –mark

    import java.util.HashMap;
    import java.util.Map;
    
    import com.webmethods.portal.system.PortalSystem;
    import com.webmethods.portal.bizPolicy.IContext;
    import com.webmethods.portal.bizPolicy.IContextProvider;
    import com.webmethods.portal.bizPolicy.command.ICommandManager;
    import com.webmethods.portal.bizPolicy.command.ICommandBean;
    import com.webmethods.portal.bizPolicy.command.task.webservice;
    
    //get the current user's context
    IContextProvider cp = (IContextProvider) PortalSystem.getContextProvider();
    IContext ctx = cp.acquireContext(true);
    
    //get the command manager
    ICommandManager cm = (ICommandManager) PortalSystem.getCommandProvider();
    
    //get the webservice version of the GetTask command that uses generic non-typed classes
    GetTaskWS getTaskWS = (GetTaskWS) cm.getCommand(ctx, GetTaskWS.COMMAND_NAME);
    
    //set the invocation properties (loosely typed)... Same inputs as the web service version
    Map props = new HashMap();
    props.put("user", <userid>);
    props.put("taskID", <taskID>);
    props.put("includeTaskData", true);
    ICommandBean cb = getTaskWS.createBean(ctx, props);
    
    //invoke
    Map results = getTaskWS.invoke(ctx, cb);

    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 3.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Tue May 24, 2011 03:54 AM

    Hi Mark,

    We have tried to implement this code in our environment for getting the task data. It seems the ‘invoke (IContext, ICommandBean)’ method is not defined in the type of object GetTaskWS and hence the compilation error is thrown in designer as ““The method invoke (IContext, ICommandBean) is undefined for the type GetTaskWS


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 4.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Tue May 24, 2011 05:30 PM

    Hi Kaleeswaran,

    You can try to extend TaskInboxSearchContentProvider.

       public class MyTaskSearchProvider extends TaskInboxSearchContentProvider {
    
    //constructor 
    public MyTaskSearchProvider(){
    m_searchQuery = new MySearchQuery();
    }
    
    public com.webmethods.caf.faces.data.task.impl.TaskData getTaskData() {
    return (com.webmethods.caf.faces.data.task.impl.TaskData) getValue(PROPERTY_TASKDATA);
    }
    
    //inner class
    public class MySearchQuery extends InboxSearchQuery {
    private TaskSearchQueryTerm myQueryTerm= null;
    
    public TaskSearchQueryTerm getMyQueryTerm() {
    if (myQueryTerm== null) {
    myQueryTerm= new TaskSearchQueryTerm();
    }
    return myQueryTerm;
    }
    
    //....
    }

    I hope this small sample will help you.

    br,
    Vlad


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 5.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Tue May 24, 2011 07:58 PM

    The GetTaskWS might not be in your projects classpath. So we can try for the more generic interfaces. Instead of

    GetTaskWS getTaskWS = (GetTaskWS) cm.getCommand(ctx, GetTaskWS.COMMAND_NAME); 

    please try this

    import com.webmethods.portal.bizPolicy.command.ICommand;
    
    ICommand getTaskWS = cm.getCommand(ctx, "getTask_ws"); 

    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 6.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Thu June 16, 2011 01:23 PM

    hi Mark,

    Tried with following code:

    ICommand getTaskWS = cm.getCommand(ctx, “getTask_ws”);
    Map results = getTaskWS.invoke(ctx, cb);

    Compilation error is coming at line 2 with message “invoke method is not defined”. I suspect that invoke method is not defined in ICommand or it’s super classes (in webMethods 7.1.2)

    Kind regards,
    Raja sekhar Kintali


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 7.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Thu June 16, 2011 05:56 PM

    Sorry. It should have been ‘handle’ instead.


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 8.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Mon June 27, 2011 06:29 AM

    hi Mark,

    Tried using methods available in ICommand interface to get Task info and Task data.

    I am successfully able to get and update Task info and Task data using this API. Thanks for your help. :slight_smile:

    Kind regards,
    Raja sekhar Kintali


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 9.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Wed August 07, 2013 07:31 PM

    Hi All,

    I wanted test the code here but not sure where are these JAR file. Can any one tell me where I can get these jar files.

    Thanks


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 10.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Tue June 03, 2014 08:51 AM

    Hi All

    Is there any way I can use these apis in a normal Dynamic webProject in the webMethods Designer by just importing few jars?? I dont want to use webservices as I am going to deploy my new webapp in MWS server itself.
    Please help!!

    Thanks
    Sajeevan


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 11.  RE: MWS Task API to retrieve TaskData in non Task Packages.

    Posted Tue June 03, 2014 09:52 AM

    If you can then keep the task project in build path of this webProject and you should be able to use all of the task API methods().


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine