HI,
We have used the following java service to retrive data from TN export. The below service accepts the TN export file name, and gives an output , and Idata named data. This data is the same as the input to the service wm.tn:importData.
Basically our idea of doing this was to create an automated backup every week. We use the wm.tn:exportData, and save the IDataBinCoder class to write the data to file (THis is same as doing an export from TN)
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String fileName = IDataUtil.getString( pipelineCursor, “fileName” );
pipelineCursor.destroy();
String successFlag=“false”;
String errorMessage=null;
IData data = IDataFactory.create();
try
{
File f = new File(fileName);
IDataBinCoder coder = new IDataBinCoder();
data = coder.readFromFile(f);
successFlag=“true”;
}
catch(Exception ex)
{
successFlag=“false”;
errorMessage=ex.toString();
}
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, “data”, data );
IDataUtil.put( pipelineCursor_1, “successFlag”, successFlag );
IDataUtil.put( pipelineCursor_1, “errorMessage”, errorMessage );
pipelineCursor_1.destroy();
REgards,
Pradeep
#webMethods#B2B-Integration#Integration-Server-and-ESB