Skip to Content
avatar image
Former Member

Query regarding Adapter Module development

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 03, 2010 at 10:35 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 06, 2010 at 07:40 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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