on 02-21-2007 10:06 AM
Hi
I'm developing a module in which an external file need to be read. For example, I am developing a module to decrypt messages, so I need read a private key from an external file.
Any hint?
Thanks!
Regards,
Hui
Hi Hui,
in the adapter module you are developing, in the EJB, in process method....just use File class to open the external file.....get its file descriptor......then in a String variable read the file contents.......then use this data for decripting your XML message.
Thanks,
Rajeev Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hui,
you dont need to bundle the file in EJB.......JUST PUT THE FILE IN YOUR XI SERVER AND GIVE THAT FILE PATH IN YOUR ejb process method like:
BufferedReader bwr1 = new BufferedReader(new FileReader("<your filepath>"));
<your filepath> will be the complete path of your file - means starting fromm root dir to our file.
Thanks,
Rajeev Gupta
Hi
We are facing same problem as above said
I'm developing a module in which an external file need to be read. For example, I am developing a module to decrypt messages, so I need to read a private key from an external file.
In Module while reading the private key file it is failing to read and going to else block and throwing "Key is null"
secretkeylocation = moduleContext.getContextData("SecretKeyLocation"); //Reading the path dynamically from channel
try {
iinKey = getClass().getResourceAsStream(secretkeylocation);
if(inKey == null)
{
throw new ModuleException("$$$$ key is null $$$$$");
}
}
NOTE:We have tried placing the pblic and private key certificates in different folder .But faced same issue again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Venkat,
== Forum Tips: ==
you should write your own post, explain your issue and give this URL thread as a reference (URL link).
By this way, your post will be not marked like "Closed. Response already providen".
By reusing a closed thread, you limit the number of people who will read it...
regards.
mickael
Hi Hui,
Check out my solution in this thread
The thread discuss about creating a file form User Defined function, you can use the same in Adapter module also.
In URL connection change type=i and get Input stream
<b>URL url = new URL("ftp://user-name:password@server/Test.txt;type=i");
URLConnection con = url.openConnection();
InputStream op = con.getInputStream();
byte [] b = new byte(op.available());
op.read(b);
op.close();
</b>
Now, "b" byte array will have the file content.
Regards,
Uma
Message was edited by:
Uma Maheswari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Please see the below links
https://websmp108.sap-ag.de/~sapdownload/011000358700003237612005E/HowToCreateAdapterModules.pdf
Regards
Chilla..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
with java it shud possible....the below code is used in a udf whic creates a new file. probably with this as a base u can check how to read a file in a module.
URL url = new URL("ftp://user-name:password@server/Test.txt;type=o");
URLConnection con = url.openConnection();
OutputStream op = con.getOutputStream();
op.write("Hello".getBytes());
op.close();
and the classes imported for the above are:
import java.net.URL;
import java.net.URLConnection;
import java.io.OutputStream;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.