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

Accessing JSP scope variables

  • 1.  Accessing JSP scope variables

    Posted Mon October 26, 2009 06:26 AM

    [FONT=Helv][SIZE=2]I am using the WmTomcat package and I would like to be able to invoke a webMethods (version 7) service (using JSPs) such as:

    [/SIZE][/FONT][FONT=Courier][SIZE=1][FONT=Courier][SIZE=1]<webm:invoke serviceName=“my.services:getAddressList”>

    [/SIZE][/FONT][/SIZE][/FONT][FONT=Helv][SIZE=2]which returns a java.util.List object in the pipeline with elements which have properties such as line1, line2, city, state .

    From there, I would like to display this using a standard JSP tag library (that has features like paging, sorting, exporting). Specifically I am using DisplayTag (from Sourceforge http://displaytag.sourceforge.net) but all other standard Java taglibs will have the same issue I have. This is NOT a webMethods-aware library, just a generic Java taglib that takes in a Java object such as a List, Enumeration, Array etc. from request/page/session scope and renders it into a table, such as:

    [/SIZE][/FONT][FONT=Courier][SIZE=2][FONT=Courier]<% request.setAttribute( “addressListAttrib”, addressList); %>
    <displayTag:table name=“addressListAttrib” />

    [/FONT][/SIZE][/FONT][FONT=Helv][SIZE=2]The problem I have is that the webMethods taglibs don’t allow me to get the results from the webMethods world (eg. pipeline) and to in a place that in a place that is known to the Java world (eg. a variable in request/page/session scope etc).

    Do I only have the option to use webMethods-provided libraries such as webm:loop etc to get access to this data (thereby losing the ability to use off-the- shelf Java paging, sorting libraries)?
    [/SIZE][/FONT]


    #If-it-doesn-t-fit-anywhere-else
    #webMethods
    #webMethods-Archive


  • 2.  RE: Accessing JSP scope variables

    Posted Wed January 20, 2010 03:56 PM

    Hello,
    It would probably help that you have export methods in your jsp to pull information out of what transfers back from webMethods. The following is what i use in 6.x:

    
    // get the value for the given key off the pipeline if it exists
    public Object getIfParam(com.wm.data.IData p, String key)
    {
    Object obj = null;
    
    if(p != null)
    {
    com.wm.data.IDataCursor i_cursor = p.getCursor();
    
    if(i_cursor.first(key))
    {
    obj = i_cursor.getValue();
    }
    
    i_cursor.destroy();
    }
    
    return obj;
    };
    
    // use
    <webm:invoke serviceName="wm.tn.profile:getProfileSummaries" />
    
    Java.util.List list = (java.util.List) getIfParam(webm_pipe, "profiles");

    There is no simplier way that I know to get at the pipeline. Prototype the output of the service in Developer so you know the structure beforehand. Good day.

    Yemi Bedu


    #webMethods-Archive
    #webMethods
    #If-it-doesn-t-fit-anywhere-else