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

Help with WmSamples idata sample - infinite loop issue in webMethods 6.5?

  • 1.  Help with WmSamples idata sample - infinite loop issue in webMethods 6.5?

    Posted Tue March 28, 2006 12:16 PM

    Hello,
    I’m trying to run WmSamples sample.idata:readAndWriteRecordList java service in webMethods 6.5. It seems to be involved in some “infinite loop” and doesn’t stop. I can run this service in webMethods 4.6 without any problems and the result is returned instantly.

    Basically, what this service is trying to do is to take the content of an input document list (recordListIn) and copy the data to an output document list (recordListOut). In each loop of the input document list, the recordListIn/field(n) is mapped to recordListOut/field-out(n)
    where (n) means that the number of fields in the document varies.

    The content of this service is available in WmSamples (sample/idata folder). I’ve also included the Java service below (for reference).
    I’m really confused why this service works in webMethods 4.6 but it keeps “looping” in webMethods 6.5 (even when I filled in only 1 record in recordListIn).

    Regards,
    Jun.


    [highlight=java]
    public static final void readAndWriteRecordList( IData pipeline ) throws ServiceException {

    // Get IDataCursor to manipulate pipeline
    IDataCursor idcPipeline = pipeline.getCursor();
    // Get input objects from pipeline. If no such key/value pair exists, returns null.
    // If more than one exists, returns the value part of the first pair.
    // If the value is not an IData, returns null.
    IData recordListIn = IDataUtil.getIDataArray( idcPipeline, “recordListIn” );
    int i, j;
    if ( recordListIn == null )
    {
    // Print to standard output an error message and exit processing
    util.Log.log(“Input could not be found in pipeline!”, “sample.idata”);
    return;
    }
    // Instantiate array of recordListOut IData objects equal to the length of
    // the recordListIn object. Now you have an array of recordListOut IData objects.
    IData recordListOut = new IData[recordListIn.length];
    // Loop over the input record list (recordListIn). If you were building a
    // record list from a vector, you would loop over the enumeration object.
    for (i = 0; i < recordListIn.length; i++)
    {
    // Each individual IData object in the array of recordListOut needs
    // to be created.
    recordListOut[i] = IDataFactory.create();
    // Need to get cursors on each individual record in the array
    IDataCursor idcRecordListIn = recordListIn[i].getCursor();
    IDataCursor idcRecordListOut = recordListOut[i].getCursor();
    idcRecordListIn.first();
    // Loop over the recordIn object while there are values
    while ( IDataUtil.getString( idcRecordListIn ) != null)
    {
    // getKey gets the name in the name/value pair.
    String key = idcRecordListIn.getKey();
    String keyOut = key + “-out”;
    // Next get the value out of the name/value pair. Note: This is a big
    // assumption that all elements in recordListIn are strings.
    String value = IDataUtil.getString( idcRecordListIn );
    // insert it into the recordOut cursor
    IDataUtil.put( idcRecordListOut, keyOut, value);
    // move to the next name/value pair in recordIn
    idcRecordListIn.next();
    }
    // Always destroy cursors
    idcRecordListIn.destroy();
    idcRecordListOut.destroy();
    }
    // Always destroy cursors
    idcPipeline.insertAfter(“recordListOut”, recordListOut);
    idcPipeline.destroy();

    return;
    }[/highlight]


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


  • 2.  RE: Help with WmSamples idata sample - infinite loop issue in webMethods 6.5?

    Posted Wed March 29, 2006 12:58 PM


  • 3.  RE: Help with WmSamples idata sample - infinite loop issue in webMethods 6.5?

    Posted Wed April 05, 2006 09:51 AM