IDataUtil.put(cursor, key, value) - java service problem

Hello, I have following problem with java service code:

IDataUtil.put(changesCursor, "myId", myId);
IDataUtil.put(changesCursor, "myType", myType);
IDataUtil.put(changesCursor, "myStatus", "N");
try {
    IDataUtil.put(changesCursor, "myDate", myDate);
} catch(Exception e) {
    os.write("exc" + e.toString());
} catch(Error err) {
    os.write("err" + err.toString());
}

os.write(…) - writes to custom log file

after that there is:

IDataUtil.put(paramsCursor, "myName", myName);
IDataUtil.put(paramsCursor, "myValue", myValue);

which puts pairs name-value list in association with first code fragment.

All of these make document like that:


myChanges [document list]
 `- myId [type=Object, wrapper=java.lang.Integer]
 `- myType [type=String, wrapper=UNKNOWN]
 `- myDate [type=Object, wrapper=java.util.Date]
 `- myStatus [type=String, wrapper=UNKNOWN]
 `- myParams [document list]
     `- myName [type=String, wrapper=UNKNOWN]
     `- myValue [type=String, wrapper=UNKNOWN]

Everything is okey when line:
IDataUtil.put(changesCursor, “myDate”, myDate);
not exists, but once it does, in My Web Methods Console in pipeline, i havent date nor value-name pair.

It looks like if I am trying to put java.util.Date object then all “puts” to pipeline fails to execute. Another weird thing is that no error or exception is thrown, and no information in Error or Server log in IS Administrator (nor server.log).

Do you ever met problem like this? How to successfully put java.util.Date object to pipeline?

With Best Regards,
GOLAN.

ps:
English is not my native language; please excuse typing error.

ps2:
Why I doing this in java service instead flow service?
I am doing so in case for performance (which lack of it we painfully felt).

Can you post the entire Java service?

source code:


//==== LOG START >>>>
String logfile = "golan.log";
boolean newLog = false;
LogOutputStream os = (LogOutputStream)openLogFiles.get(logfile);
if(os == null) {
    os = ServerAPI.getLogStream(logfile);
    openLogFiles.put(logfile, os);
    newLog = true;
}
//==== LOG STOP <<<<


SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

// mapa z kluczem IdChange przechowuje ChangeType
Map<Integer, String> map1 = new HashMap<Integer, String>();
// mapa z kluczem IdChange przechowuje DateOfChange
Map<Integer, Date> map2 = new HashMap<Integer, Date>();
// mapa z kluczem IdChange przechowuje liste napisow naprzemian ParamName, ParamValue
Map<Integer, List<String>> map3 = new HashMap<Integer, List<String>>();

// lista identyfikatorow zmian
List<Integer> list = new ArrayList<Integer>();

int recordCount = 0;
int parametersCount = 0;

// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();

// unpack tree
IData node1 = IDataUtil.getIData(pipelineCursor, "node1");
if (node1 != null) {
    IDataCursor node1Cursor = node1.getCursor();
    IData node2 = IDataUtil.getIData(node1Cursor, "node2");
    if (node2 != null) {
        IDataCursor node2Cursor = node2.getCursor();
        IData node3 = IDataUtil.getIData(node2Cursor, "node3");
        if (node3 != null) {
            IDataCursor node3Cursor = node3.getCursor();
            IData node4 = IDataUtil.getIData(node3Cursor, "node4");
            if (node4 != null) {
                IDataCursor node4Cursor = node4.getCursor();
                IData[] table = IDataUtil.getIDataArray(node4Cursor, "table");
                if (table != null) {
                    recordCount = table.length;
                    for (int i = 0; i < recordCount; i++) {
                        IDataCursor tableCursor = table[i].getCursor();
                        Integer id = Integer.parseInt((String) IDataUtil.get(tableCursor, "id"));
                        String type = IDataUtil.getString(tableCursor, "type");
                        Date date = null;
                        try {
                            date = sdf.parse((String) IDataUtil.get(tableCursor, "date"));
                        } catch (ParseException e) {
                            os.write("error parsing date" + e);
                        }

                        map1.put(id, type);
                        map2.put(id, date);

                        list.add(id);

                        tableCursor.destroy();
                    }
                }

                // change list parameters
                IData[] parameters = IDataUtil.getIDataArray(node4Cursor, "params");
                if (parameters != null) {
                    parametersCount = parameters.length;
                    for (int i = 0; i < parametersCount; i++) {
                        IDataCursor parametersCursor = parameters[i].getCursor();
                        Integer id =
                                Integer.parseInt((String) IDataUtil.get(parametersCursor, "id"));
                        String name = IDataUtil.getString(parametersCursor, "name");
                        String value = IDataUtil.getString(parametersCursor, "value");

                        List<String> parameterList = map3.get(id);
                        if (parameterList == null) {
                            parameterList = new ArrayList<String>();
                        }

                        parameterList.add(name);
                        parameterList.add(value);
                        map3.put(id, parameterList);

                        parametersCursor.destroy();
                    }
                }
                node4Cursor.destroy();
            }
            node3Cursor.destroy();
        }
        node2Cursor.destroy();
    }
    node1Cursor.destroy();
}
pipelineCursor.destroy();

//==== LOG START >>>>
Iterator it = map1.entrySet().iterator();
while (it.hasNext()) {
    Map.Entry<Integer, String> pairs = (Map.Entry<Integer, String>)it.next();
    os.write(new StringBuilder().append(pairs.getKey()).append(" = ").append(pairs.getValue()).toString());
}

it = map2.entrySet().iterator();
while (it.hasNext()) {
    Map.Entry<Integer, Date> pairs = (Map.Entry<Integer, Date>)it.next();
    os.write(new StringBuilder().append(pairs.getKey()).append(" = ").append(pairs.getValue()).toString());
}

StringBuilder sb = new StringBuilder("id list:");
for (int i = 0; i < list.size(); i++) {
    sb.append(' ').append(list.get(i));
}
os.write(sb.toString());

it = map3.entrySet().iterator();
while (it.hasNext()) {
    Map.Entry<Integer, List<String>> pairs = (Map.Entry<Integer, List<String>>)it.next();
    Integer intLog = pairs.getKey();
    List<String> listLog = pairs.getValue();
    os.write(new StringBuilder().append("id=").append(intLog.toString()).toString());
    for (int i = 0; i < listLog.size(); i+=2)
        os.write(new StringBuilder().append(" ").append(listLog.get(i)).append(" = ").append(listLog.get(i+1)).toString());
}

//==== LOG STOP <<<<

// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();

// changes
IData[] myChanges = new IData[recordCount];
for (int i = 0; i < myChanges.length; i++) {
    // utworzenie obiektu
    myChanges[i] = IDataFactory.create();

    // pobranie kursora dla obiektu
    IDataCursor changesCursor = myChanges[i].getCursor();

    Integer myId = list.get(i); // pobranie numeru zmiany
    String myType = map1.get(myId); // pobranie typu zmiany
    Date myDate = map2.get(myId); // pobranie daty zmiany

    // status
    IDataUtil.put(changesCursor, "myId", myId);
    IDataUtil.put(changesCursor, "myType", myType);
    IDataUtil.put(changesCursor, "myStatus", "N");
    IDataUtil.put(changesCursor, "myDate", myDate);

    // operacje na parametrach zmiany
    List<String> paramsList = map3.get(myId);

    // pobranie ilosci parametrow
    int size = paramsList.size() / 2;

    IData[] myParams = new IData[size];
    for (int j = 0; j < myParams.length; j++) {

        myParams[j] = IDataFactory.create();
        IDataCursor paramsCursor = myParams[j].getCursor();

        String myName = paramsList.get(j * 2); // pobranie nazwy parametru
        String myValue = paramsList.get(j * 2 + 1); // pobranie wartosci parametru

        IDataUtil.put(paramsCursor, "myName", myName);
        IDataUtil.put(paramsCursor, "myValue", myValue);

        paramsCursor.destroy();
    }
    IDataUtil.put(changesCursor, "myParams", myParams);
    changesCursor.destroy();
}
IDataUtil.put(pipelineCursor_1, "myChanges", myChanges);
pipelineCursor_1.destroy();

//==== LOG DELETE START >>>>
if(os != null)
{
  openLogFiles.remove(logfile);
  os.close();
}
//==== LOG DELETE STOP <<<<

docIn:


node1
`- node2
   `- node3
      `- node4
         `- table
	    `- id
	    `- type
	    `- date
	 `- params
	    `- name
	    `- value

docOut:


myChanges
`- myId
`- myType
`- myStatus
`- myDate
`- myParams
   `- myName
   `- myValue

I don’t see anything that would explain the behavior.

When you run this service directly, does it work as expected? Perhaps it is is a display issue of some sort with MWS?