Saturday, November 4, 2017

To Create File using Connect File

To write a txt/xml file to Service Export directory:

In this post, we will see how to create text file using connect file rule in the "\StaticContent\global\ServiceExport" folder

Below are the steps to follow:










Step1: get the string which need to be written in the file. in our case, small xml string and getting in the parameter.








Step2: In java step, getting the path of the temp folder in a string, which will be passed to the connect file.











try {
     explicitTmpDir  = tools.getSystemSettings().getFSSetting("initialization/explicittempdir", "" , true, false);
if (explicitTmpDir == null || explicitTmpDir.length() == 0) {
explicitTmpDir = "Not Found By Method";
}
}
catch (Exception setCNF) {
explicitTmpDir = "Not Found By Exception: " + setCNF.toString();
}

Step3: setting the temp path string in Test Page.








Step4: Calling the Connect File Method, and Connect File Rule need to be created as follows:








Connect File rule need to be created with the below parameter setting which we set the values in the above activity.



















Please try and let me know the comments if any issues are anything need to be modified.

2 comments: