cancel
Showing results for 
Search instead for 
Did you mean: 

Module Developement

Former Member
0 Kudos

Hi all

I have written a customized adapter module , the adapter module is checking for the existence of a particular file if the file will be present in the directory then it will delete that file and then process the file given the adapter else it will stop the processing of the file. the dapter id using the FTP protocol.

The problem is when i run the code in java using the cmd prompt then it is able to connect to the ftp server and able to delete the file form the ftp serevr directory, but when i write the same code in the NWDS using the ejb and deployed it on the server the code is not able to delete the file from the directory.

can any one of you please tell me why it is not able to delete the file from the directory.

Thanks

Rinku

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member190389
Active Contributor
0 Kudos

Hi,

See here in the code:

public static void main(String[] argv) throws Exception

{

URL u = new URL("ftp://Rinku1:rinku123@10.58.44.44");

URLConnection uc = u.openConnection();

bold File f1 = new File("C:/Rinku1/Test.txt"); bold

}

the code in the bold part is wrong . You have to check the file on ftp and not NFS .

you are performing f1.delete(); which will del the file from " C:"and not ftp .

to read the file content use

 
URL u = new URL("ftp://ftp.address/Rinku1/Test.txt");
URLConnection uc = u.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader( uc.getInputStream()) ); 

//to write file sumwhere else
BufferedWriter out = new BufferedWriter( new FileWriter( "c:\\Scan file test\\read\\new.txt" ) );  

Edited by: Progirl Progirl on Jun 9, 2008 8:13 AM

Former Member
0 Kudos

Hi Rinku,

You can use this function in your EJB code:

Delete():

Signature:

public boolean delete()

Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted.

Returns:

true if and only if the file or directory is successfully deleted; false otherwise

Throws:

SecurityException - If a security manager exists and its SecurityManager.checkDelete(java.lang.String) method denies delete access to the file

The above mentioned method is in class, java.io.file

Thanks,

Varun

former_member181985
Active Contributor
0 Kudos

Hi Runku,

Execute your standalone code(CMD Prompt) in XI Server direclty and let us know the stauts of File Deletion.

Thanks,

Gujjeti

Former Member
0 Kudos

Hi

thanks for your reply.

i have run the same code on my local machine because i have installed the ftp server on my local nmachine so the same code is able to delete the file from the directory using the ftp server connection parameters.

any other suggestions will be appriciated.

Thanks

Rinku

Edited by: Rinku Gangwani on Jun 5, 2008 2:59 PM

I am facing the problem while implementing the customized module.

i have written the following code that is used to delete the file from the FTP server directory.

import java.net.*;

import java.io.File;

import java.io.InputStream;

public class FTPRead

{

public static void main(String[] argv) throws Exception

{

URL u = new URL("ftp://Rinku1:rinku123@10.58.44.44");

URLConnection uc = u.openConnection();

File f1 = new File("C:/Rinku1/Test.txt");

boolean success = f1.exists();

String a = f1.getName();

System.out.println(a);

if(success )

{

System.out.println("Welcome to if loop");

f1.delete();

System.out.println("File Deleted from the directory");

}

else

{

System.out.println("Welcome to else loop");

System.out.println("File not present in the directroy");

}

}

}

when i am running this code as a standalone application it is able to connect to the FTP server and able to delte the file from the FTP serevr directory.

but when i create the moduke using the same code that it is not able to delete the file from the FTP directiry.

please provide the inputs for the same.

the help will be appriciated.

Thanka

Rinku Gangwani

Edited by: Rinku Gangwani on Jun 9, 2008 7:40 AM

former_member187563
Contributor
0 Kudos

hi,

u check following things:

1.Have you written the code properly and created its .ear properly.

2.Have u checked on visual admin whether that is successfully deployed or not.

3.Check whether it is active or not.

you can refer to this link

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d7...

moreover you can see in RWB whether that module is executed or not and whats the error.

regards,

ujjwal kumar

Former Member
0 Kudos

Hi

Thanks for your reply. i have done he sam thing.The ear file is deployed on the server successfully.The channel is active.

The same code when i tried with ther NFS, then it is working fine, able to delete the file from the directiory, but when i am using with the ftp it is not able to delete the file from using the ftp server connection.

any other suggestion will be appriciated.

Thanks

Rinku

former_member187563
Contributor
0 Kudos

hi,

then you check whether you are calling the module properly,that is you have written its name and type properly in the module tab.

if you are using more no. of modules then whether it is placed at the right position(before adapter module).

You check the status in RWB..and let me know what its saying.Whether its giving lookup error or it is not executing the module at all and you are getting some error in sxi_monitor.

regards,

ujjwal

Former Member
0 Kudos

Hi

while using the adapter modulei have given the module name at the first postion because the customized module first check the existence of the file in the directory then it will process the file that we have given in the sender communication channel.

so when i run the scenario with the module then it will connect to the ftp server using the module and delete the sender communication channel file without deleting that test file.

in RWB the adapter status is grenn with the message file processed successfully,

Thanks

Rinku

former_member187563
Contributor
0 Kudos

hi,

ok then placement is right.

in RWB on left side of message you have mesage id click on that and see the audit log.There you can see whether your module is executed or not.If your module is executed there and you are not getting desired output then it means your parameters of module are not correct.

regards,

ujjwal kumar

Former Member
0 Kudos

Hi

when i run the module then it will print the audit message in the audit log and the audit messages we can check in the MessagingSystem it is priniting the audit messages.

but the problem is that, i have written the code for checking the existence of the file in the ftp server directory, if the file exists in the directory then it will delete the file else it will stop the processing.

but when the module check for the existence of the file then each time it is returning the fals, so i use the function for delete the file in the else part of the code but again it is not able to delete the file from the directory.

any other suggesstions will be appriciated,

Thanks

Rinku

Former Member
0 Kudos

Hi

Can you check that the user id that you use in XI for the FTP server has all rights over the file (read, write, delete and rename).