wM 6.5 not returning table data to SAP RFC

I have an issue when SAP calls webMethods 6.5 passing an input parameter and expecting a table to be returned to SAP. The problem is, the table is not being returned (at least not completely - sometimes).

The service currently works in webMethods 4.6. The java class being returned is com.wm.data.BasicData.

If the webMethods 6.5 service just does a MAP step and hardcodes values for the output table, then the java class is set to wm.com.util.Values and the table is successfully passed back to SAP. Obviously, we can’t put that into Production!

If the webMethods 6.5 service is coded as required, the java class can be one of two classes: com.wm.data.ISMemDataImpl (when using a LOOP to create the output table) or com.wm.data.IData (when using a MAP after doing the LOOP, i.e. the MAP converts the com.wm.data.ISMemDataImpl to com.wm.data.IData).
When the java class is ISMemDataImpl, no data is returned in the SAP table.
When the java class is IData, all 20 records are returned but only the first field in each record of the table is populated (there are 4 fields in each record).

Since the SAP RFC worked when we hardcoded the output table (java class is Values), I also tried casting IData back to Values using com.wm.util.Values.use() - even though it is deprecated - but this also returned the first field in each record.

Any assistance would be appreciated.

I had the same problem…to work around it I created a Java service to ensure that the output is always Values

INPUT docList (document list) (unknown exactly which specific object but implements IData)
OUTPUT docListValues (document list - always Values)

CODE:

[highlight=java]
IDataCursor idc = pipeline.getCursor();

try {
Object oDocList = IDataUtil.get(idc, “docList”);
IDataUtil.remove(idc, “docListValues”);
if (oDocList != null) {
IData docList = (IData) oDocList;
Values docListValues = new Values[docList.length];
for (int i=0; i < docList.length; i++) {
IDataCursor idcDocList = docList[i].getCursor();
docListValues[i] = new Values();
while (idcDocList.next()) {
String key = (String) idcDocList.getKey();
Object value = idcDocList.getValue();
docListValues[i].put(key, value);
}
}
IDataUtil.put(idc, “docListValues”, docListValues);
}
} catch (Exception e) {
throw new ServiceException(e.toString());
} finally {
idc.destroy();
}[/highlight]

Thanks Tony.

After initially trying this java code, it still did not work. That was until I changed the flow service to do the following:

  1. LOOP through results (java class Values) and MAP to tempResults (java class ISMemDataImpl)
  2. MAP tempResults (java class ISMemDataImpl) to tempResults_IData (java class IData)
  3. Use java code to convert tempResults_IData (java class IData) to OUTPUT_RECORDLIST (java class Values)

After this worked, I tried it with our original java code and it also worked.

So the trick is: make sure your target and destination record names are different, e.g. the java service might have input and output paramaters called inRec and outRec so use tempResults_IData and OUTPUT_RECORDLIST as the pipeline records that you map from and to. I originally mapped tempResults to OUTPUT_RECORDLIST and then passed OUTPUT_RECORDLIST into the java service and mapped back into OUTPUT_RECORDLIST, thinking that webMethods flow would completely overwrite the record, but it didn’t (even though the class name had changed!).