on 08-03-2010 4:30 PM
Hi Experts,
I'm working on a scenario File (Text) --> XI ---> SAP (Idoc). I have to add validation for the file based on the data contained in it. I'm planning to do this usng a adapter module.
I have already started coding the module, but need confirmation on on 1 point.
The usual code for method public ModuleData process is as follows:
obj = imd.getPrincipalData();
msg = (Message) obj;
msgType = (String) mc.getContextData("msgType");
nameSpace = (String) mc.getContextData("nameSpace");
amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.OUTBOUND);
XMLPayload xp = msg.getDocument();
I'm succesfully able to achieve the required validation in a java class but using the file stored in my local directoy.
Now my question is that will the object xp hold the contents of text file as it or will it contain the xmlpayload.
I will be execuitng the module before the standard CallSapAdapter in module tab.
Your reply is highly apreciated.
Thanks,
Pragati
Hi,
I'm able to succefully run my Filevalidatiobean for NFS protocol, but I'm facing issues with FTP protocol.
I can read the source file directory, source filename from the channel, but the file itself is not read.
Below is the code piece:
sourDir = channel.getValueAsString("ftp.sourceDir");
String filename = channel.getValueAsString("file.sourceFileName");
localFile = sourDir + "
" + filename; }
inputFile = new File(localFile);
if I do a inputFile.exists() then it returns false, which means it is not able to locate the file.
The audit log entries for the scenario are as follows:
Source FileName: tes.txt
Source Directory: /ftproot/input
Source File Location: /ftproot/input/test.txt
File exists at location: false
Please let me know if there is any change for ftp.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arvind,
Thanks for the link. I tried and tested the code uisng a standalone java application. I'm able to fetch the filenmes and files from the ftp directory, but it seems that I cannot directly read the file data from ftp seerver.
Can you tell me that is it necessary to copy a file from FTP server to the local directory to read the data from it. If ths is true should my adapter module first copy the file from FTP server to local directory on PI server.
Also if I want to copy a 200MB file from FTP to PI server will ithere be any performance issues?
Regards,
Pragati
Hi Pragati,
This should be before the CallSapAdapter module, it contain the xmlpayload because the module CallSapAdapter sends the message from AF to XI.
regards,
lpbuff
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If this contains the xml payload its of no use to me. Can you tell me how can I access the file data directly using a custom module?
Will I be able to access the source directory path and filename mentioned in the channel configuration in teh adapter module?
How do I generate the instance of the channel?
Regards,
Pragati
Hi Pragathi,
Can you tell me how can I access the file data directly using a custom module
u can create a adapter module and call it in sequence before the standard module... now u can access the whole file as a object.
Will I be able to access the source directory path and filename mentioned in the channel configuration in teh adapter module?
Yes u can. Pass them as parameter to process method, ModuleConext obj has these details.
Babu
Hi,
I'm developing teh adapter module for PI 7.1 server. I have imported the required jar files in my project (these jar files are directly obtained from the server).
I need to add a line in my ciode to fetch the current channel :
Channel channel = new Channel(moduleContext.getChannelID());
but the issue is that I'm unabel to create the object of class Channel.
I can see "Channel.class" file in the jar file "com.sap.aii.af.cpa.svc.api.jar". This jar is already added in the build path.
Please let me now if anyone has a clue about this.
Regards,
Pragati
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.