Hi Senthil, I see what you are saying but in webMethods 8.0 we have a enhanced “getFile” java service which gives the file data in either “byte”, “stream”, “reader” or “string”.
I am taking the output of that service as “string” and directly using it but it is giving me “null”, I am not getting where is the problem.
Please go through the documentation of 8.0 version before looking into this code for “getFile” built-in java service.
IData loadAs=IDataFactory.create();
IDataCursor loadAsCursor=loadAs.getCursor();
loadAsCursor.setValue(((Object) “string”));
try {
context.invoke(“pub.file”,“getFile”, loadAs);
body=context.invoke(“pub.file”,“getFile”,fileName);
} catch(Exception e) {
e.printStackTrace();
throw new ServiceException(“\n”+“Could not invoke the file”);
}
try {
bodyCursor=body.getCursor();
if(bodyCursor.first(“string”)) {
string=IDataUtil.getIData(bodyCursor,“string”);
stringCursor=string.getCursor();
xmlFileData=(String) stringCursor.getValue();
}
/if(pipeLineCursor.first(“body”)) {
body=IDataUtil.getIData(pipeLineCursor,“body”);
bodyCursor=body.getCursor();
if(bodyCursor.first(“string”)) {
string=IDataUtil.getIData(bodyCursor,“string”);
stringCursor=string.getCursor();
xmlFileData=(String) stringCursor.getValue();
}
}/
/if(pipeLineCursor.first(“string”)) {
string=IDataUtil.getIData(bodyCursor,“string”);
stringCursor=string.getCursor();
xmlFileData=(String) stringCursor.getValue();
}/
/if(pipeLineCursor.first(“body”) && bodyCursor.first(“string”)) {
xmlFileData=(String) stringCursor.getValue();
}/
} catch(Exception e) {
e.printStackTrace();
throw new ServiceException(“\n”+“Could not retrieve data from the file”);
}
Thanks,
Venkat.
#Flow-and-Java-services#Integration-Server-and-ESB#webMethods