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
  • 1.  Document name through java service.

    Posted Tue June 08, 2010 10:08 AM

    Hi all,
    I have read posts pertaining to how to retrieve the document name through java service using IDataCursor.getKey() method.

    I have a different scenario here.
    I have a document which in turn contain many sub documents like

    xyz

    • abc1
    • abc2
    • abc3

    where xyz is the parent document and abc1, abc2, abc3 are all the sub documents at the same level.

    Now i need to retrieve the names of the sub documents(i.e. abc1, abc2, abc3)

    Can anyone pls suggest?

    Thanks,
    Krithiga M


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


  • 2.  RE: Document name through java service.

    Posted Tue June 08, 2010 07:23 PM

    Hope this helps:

    idc = pipeline.getCursor();
    IData myRecord = IDataUtil.getIData(idc, “myRecordFromIS”);
    idc.destroy();
    if(myRecord != null)
    {
    idc = myRecord.getCursor();
    myField = IDataUtil.getString(idc, “myFieldinDocument”);
    }

    IData resources = IDataUtil.getIDataArray(idc_r, “Resources”);
    idc_r.destroy();
    if(resources != null)
    {
    for(int i = 0; i < resources.length; i++)
    {
    idc_r = resources[i].getCursor();
    String name = IDataUtil.getString(idc_r, “ResourceName”);
    idc_r.destroy();
    if(Resource == null)
    {
    Object ot = { { “ResourceName”, “WOLFThread” } };
    Resource = new IData[1];
    Resource[0] = IDataFactory.create(ot);
    }
    RESOURCEFINDLOOP:for(int j = 0; j < Resource.length; j++)
    {
    if(Resource[j] != null)
    {
    IDataCursor idc_tmp = Resource[j].getCursor();
    String name_tmp = IDataUtil.getString(idc_tmp, “ResourceName”);
    idc_tmp.destroy();
    if(name_tmp != null && name_tmp.equals(name))
    {
    resources[i] = null;
    Resource[j] = null;

    break RESOURCEFINDLOOP;
    }
    }
    }

    check for syntax but I hope this helps…


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


  • 3.  RE: Document name through java service.

    Posted Fri June 11, 2010 06:48 AM

    Ok, If you’d go thru the Java API guide you would have seen these methods too along with getKey():

    first() and next() both them return booleans.

    the first one moves the cursor to the first element and the second moves the cursor to the next element in the cursor.

    Using these three constuct a simple code block like so:

     
    IData xyz = IDataUtil.getIData( pipelineCursor, "xyz" );
    IDataCursor xyzCursor = xyz.getCursor();
    
    xyzCursor.first();
    
    do{
    String docName = xyzCursor.getKey();
    ...<do what ever you want with the docName>..
    } while(xyzCursor.next());
    

    This is just one simple way to do, hope you can improvise from here.

    Hope this helps.


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


  • 4.  RE: Document name through java service.

    Posted Mon June 14, 2010 11:18 AM

    hi nigel_belanger and suren,
    thanks for the suggestions.
    it helped me a lot…

    thanks again,
    krithiga


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