Length parameter in adapter module

Hello,
With sender J2EE JMS adapter i configured flat to xml conversion with localejbs/AF_Modules/MessageTransformBean.
For parameter xml.fieldNames I have  35 fieldnames and the length of the value of the parameter becomes 347. However it seems that length of the parameter is not allowed to exceed 256.
Am i right? Does anybody have a workaround. Adjusting length of my fieldnames is not possible.
tnx
emile
Message was edited by: Emile Hermans

Apply patch 11 or higher, then the restriction will no longer be valid.
Stefan

Similar Messages

  • How to get parameter for Adapter Module ?

    Hi XI Expert,
    I have write some simple adapter module in my sender file adapter. in order to make it more flexible i need to read some parameter that already set in communication channel module parameters.
    please advise how to get those parameter value from my ejb module.
    Thank You and Best Regards
    Fernand

    hi,
    follow this example SAP contribution for parameter in Adapter Module
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a
    Regards
    Ramesh P

  • Get poll interval parameter from adapter module

    Hi,
    I'd like to make special treatment in my adapter module based on the "poll interval" information filled in Processing Parameters part of the adapter configuration.
    Can an adapter module access this information?
    regards
    Yann

    Hi Yann,
    >>>>Can an adapter module access this information?
    of course it can you just have to use
    a correct parameter's name
    check this post to get the java code
    Re: Access the URL Parameter from a Adaptermodule
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Parameter name in module configuration of adapter module in comm channel

    Hi Experts,
    I have developed an adapter module to read a excel file , have used the module in the sender file adapter.
    What entrie should i put in parameter name and parameter value  in module configuration of adapter module in comm channel.
    Im too confused,,pls help

    Hi Ivan,
    The code is basically to read the all colums add em under xml tags and read from second row on wards the data
    please find below the module data code
    public ModuleData process(ModuleContext mc, ModuleData imd)throws ModuleException
                             Object obj = null;
                             Message msg = null;
                             MessageKey amk = null ;
                        amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
                        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Module called");
                        try {
                                  obj = imd.getPrincipalData();
                                  msg = (Message) obj;
                                  XMLPayload xp = msg.getDocument();
                                  if (xp != null)
                                        byte by[] = convert(xp.getContent());
                                             xp.setContent(by);
                                       imd.setPrincipalData(msg);
                              catch (Exception e)
                    return imd;
                   public byte[] convert(byte src[]) throws Exception
                        String xmldata = "";
                   try
                             ByteArrayInputStream byteArr = new ByteArrayInputStream(src);
                             Workbook w = Workbook.getWorkbook(byteArr);
                             xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"+ "<ns0:""MT_ExcelFiles"" ""xmlns:ns0=\"""urn:xyz:abc"+"\"> \n";
                               int a = w.getSheet(0).getRows();
                               int b = w.getSheet(0).getColumns();
                        for(int j=1;j<a;j++)
                                   for(int i=0;i<b;i++)
                                                  xmldata = xmldata + "<"w.getSheet(0).getCell(i,0).getContents().toString()">"w.getSheet(0).getCell(i,j).getContents().toString()"</"w.getSheet(0).getCell(i,0).getContents().toString()">";
                        xmldata = xmldata"</ns0:""MT_ExcelFiles"+">";
                        w.close();
              catch (Exception e)
           return xmldata.getBytes();

  • Adapter Modules: Set parameter values dynamic?

    Hi everybody,
    is it possible to set parameter values in adapter modules dynamic?
    Thanks Regards
    Mario

    Hi all,
    thanks for your replies.
    My problem is not solved.
    To make it clear,
    I want to set an attachmentName in Mail receiver adapter WITHOUT using the MailPackage.
    This is possible:
    ModuleName:        localejbs/AF_Modules/MessageTransformBean
    ModuleType:        LocalEnterpriseBean
    ModuleKey:        CHAN
    Parametername:        Transform.ContentDisposition
    ParameterValue:        attachment; filename="NameOfAttachment.txt"
    I want to set "NameOfAttachment.txt" dynamically. How can I achieve this? Thanks, regards
    Mario

  • Error in Adapter Module to unzip files

    Hello ,
    I wish to unzip many files with use of an adapter module
    To du this I use following code
    package de.lsv.moduledevelopement;
    import java.io.*;
    import java.util.Hashtable;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import javax.ejb.CreateException;
    import com.sap.aii.af.mp.module.Module;
    import com.sap.aii.af.mp.module.ModuleContext;
    import com.sap.aii.af.mp.module.ModuleData;
    import com.sap.aii.af.mp.module.ModuleException;
    import com.sap.aii.af.ra.ms.api.Message;
    import com.sap.aii.af.ra.ms.api.MessageDirection;
    import com.sap.aii.af.ra.ms.api.Payload;
    import com.sap.aii.af.ra.ms.spi.Trace;
    import com.sap.aii.af.service.auditlog.Audit;
    import com.sap.aii.af.service.auditlog.AuditDirection;
    import com.sap.aii.af.service.auditlog.AuditLogStatus;
    import com.sap.aii.af.service.auditlog.AuditMessageKey;
    * @ejbLocal <{de.lsv.moduledevelopement.UnZipFilesLocal}>
    * @ejbLocalHome <{de.lsv.moduledevelopement.UnZipFilesLocalHome}>
    * @stateless
    public class UnZipFilesBean implements SessionBean, Module {
         static AuditMessageKey amk = null;
         static String auditStr = "UnzipFilesBean - ";
         static ModuleException mEx = null;
         public static final String VERSION_ID =
              "$Id://de.lsv.moduledevelopement.UnZipFilesBean.java#1 $";
         private static final Trace TRACE = new Trace(VERSION_ID);
         public void ejbRemove() {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setSessionContext(SessionContext context) {
              myContext = context;
         private SessionContext myContext;
          * Create Method.
         public void ejbCreate() throws CreateException {
              // TODO : Implement
         /* (non-Javadoc)
          * @see com.sap.aii.af.mp.module.Module#process(com.sap.aii.af.mp.module.ModuleContext, com.sap.aii.af.mp.module.ModuleData)
         public ModuleData process(
              ModuleContext moduleContext,
              ModuleData inputModuleData)
              throws ModuleException {
              Object obj = null;
              Message msg = null;
              Payload attachment = null;
              //initializing variables for module parameters
              String modkey = "";
              String fileMask = "";
              String directory = "";
              String saveDirectory = "";
              //     String newMimeType = "";
              //     String newAttachmentName = "";
              //     String newAttachmentExtension = "";
              //     String newAttachmentNameReplace = "";
              //this block is to manage the adapter when is not file/FTP
              try {
                   //get the XI Message
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message) obj;
                   // create AuditMessageKey object to write audit log.
                   if (msg.getMessageDirection() == MessageDirection.INBOUND)
                        amk =
                             new AuditMessageKey(
                                  msg.getMessageId(),
                                  AuditDirection.INBOUND);
                   else
                        amk =
                             new AuditMessageKey(
                                  msg.getMessageId(),
                                  AuditDirection.OUTBOUND);
                   // ******start get the module parameters from the configuration******
                   modkey = moduleContext.getContextData("module.key");
                   Audit.addAuditLogEntry(
                        amk,
                        AuditLogStatus.SUCCESS,
                        auditStr + "Module Configuration Key: " + modkey);
                   //***** einlesen der Moduke Parameter******************
                   //***** DateiMaske
                   fileMask = moduleContext.getContextData("FileMask");
                   Audit.addAuditLogEntry(
                        amk,
                        AuditLogStatus.SUCCESS,
                        auditStr + "FileMask: " + fileMask);
                   // check ob fileMask definiert ist
                   if (fileMask == null || fileMask.equalsIgnoreCase("")) {
                        //if no attachment name is specified in the module configuration the module will end the execution
                        throw mEx =
                             new ModuleException(
                                  auditStr
                                       + "!FileMask in Modulconfiguration nicht definiert!");
                   //***** DateiMaske2
                   String fileMask2 = moduleContext.getContextData("FileMask2");
                   Audit.addAuditLogEntry(
                        amk,
                        AuditLogStatus.SUCCESS,
                        auditStr + "FileMask2: " + fileMask2);
                   //***** Directory
                   directory = moduleContext.getContextData("Directory");
                   Audit.addAuditLogEntry(
                        amk,
                        AuditLogStatus.SUCCESS,
                        auditStr + "Directory: " + directory);
                   // Fehler wenn Directory nicht definiert
                   if (directory == null || directory.equalsIgnoreCase("")) {
                        //the module will end the execution
                        throw mEx =
                             new ModuleException(
                                  auditStr
                                       + "Directory in Modulconfiguration nicht definiert");
                   //***** Sicherungs Verzeichnis
                   saveDirectory = moduleContext.getContextData("SaveDirectory");
                   Audit.addAuditLogEntry(
                        amk,
                        AuditLogStatus.SUCCESS,
                        auditStr + "SaveDirectory: " + saveDirectory);
                   // entpacken aufrufen
                   entpacke(directory, saveDirectory, fileMask);
                   if (fileMask2.length() > 0) {
                        entpacke(directory, saveDirectory, fileMask2);
                   //update the XI Message
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
                   String errorMessage =
                        auditStr + "Error bei der . Exception:" + e.getMessage();
                   Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, errorMessage);
                   throw mEx = new ModuleException(auditStr + errorMessage);
              Audit.addAuditLogEntry(
                   amk,
                   AuditLogStatus.SUCCESS,
                   auditStr + "Verarbeitung beendet ");
              return inputModuleData;
         //+++++++++++++++++++++++++
         private static void entpacke(
              String directory,
              String saveDirectory,
              String mask)
              // TODO Auto-generated method stub
              Audit.addAuditLogEntry(
                   amk,
                   AuditLogStatus.SUCCESS,
                   auditStr + "Funktion entpacke");
              if (!directory.endsWith("\")) {
                   directory = directory + "\";
              } // if
              File f;
              f = new File(directory);
              Audit.addAuditLogEntry(
                   amk,
                   AuditLogStatus.SUCCESS,
                   auditStr + "f = new File(directory)");
    //          // Achtung Klasse in einer Klasse :-)
    //          String[] strFiles = f.list(new FilenameFilter() {
    //               public boolean accept(File file, String filename) {
    //                    Wildcard wildcard1 = new Wildcard(mask);
    //                    Audit.addAuditLogEntry(
    //                         amk,
    //                         AuditLogStatus.SUCCESS,
    //                         auditStr + "wc1");
    //                    return wildcard1.match(filename, false);
              String [] strFiles = f.list(new MyFilter(mask));
              // Liste der Gefundenen dateien
              Audit.addAuditLogEntry(
                   amk,
                   AuditLogStatus.SUCCESS,
                   auditStr + "Anzahl gepackter Dateien: " + strFiles.length);
              //System.out.println( strFiles.length + " Dateien zum entpacken");
              for (int i = 0; i < strFiles.length; i++) {
                   Audit.addAuditLogEntry(
                        amk,
                        AuditLogStatus.SUCCESS,
                        auditStr + "verarbeite Datei: : " + strFiles<i>);
                   //     System.out.println("f[" + i + "]=" + strFiles<i>);
              } // for
              // *****entpacken**********************
              for (int i = 0; i < strFiles.length; i++) {
                   try {
                        byte[] buf = new byte[4096];
                        ZipInputStream in =
                             new ZipInputStream(
                                  new FileInputStream(directory + strFiles<i>));
                        Audit.addAuditLogEntry(
                             amk,
                             AuditLogStatus.SUCCESS,
                             auditStr + "Entpacke " + directory + strFiles<i>);
                        //System.out.println("Entpacke " + directory + strFiles<i>);
                        int count = 0;
                        while (true) {
                             count++;
                             // Nächsten Eintrag lesen
                             ZipEntry entry = in.getNextEntry();
                             if (entry == null) {
                                  break;
                             // Beschreibung ausgeben
                             Audit.addAuditLogEntry(
                                  amk,
                                  AuditLogStatus.SUCCESS,
                                  auditStr + entry.getName());
                             //System.out.println(entry.getName());
                             // Ausgabedatei erzeugen
                             FileOutputStream out =
                                  new FileOutputStream(directory + entry.getName());
                             int len;
                             while ((len = in.read(buf)) > 0) {
                                  out.write(buf, 0, len);
                             out.close();
                             // Eintrag schließen
                             in.closeEntry();
                        } // while
                        in.close();
                        Audit.addAuditLogEntry(
                             amk,
                             AuditLogStatus.SUCCESS,
                             auditStr + count + "Dateien entpackt");
                        //System.out.println(count + "Dateien entpackt");
                        // verschieben
                        if (saveDirectory.length() > 0) {
                             File quelle = new File(directory + strFiles<i>);
                             File ziel = new File(saveDirectory + strFiles<i>);
                             boolean bla = quelle.renameTo(ziel);
                             if (!bla) {
                                  Audit.addAuditLogEntry(
                                       amk,
                                       AuditLogStatus.SUCCESS,
                                       auditStr
                                            + strFiles<i>
                                            + " konnte nicht verschoben werden");
                             } else {
                                  Audit.addAuditLogEntry(
                                       amk,
                                       AuditLogStatus.SUCCESS,
                                       auditStr
                                            + strFiles<i>
                                            + "verschoben nach "
                                            + saveDirectory);
                                  //          System.out.println(
                                  //               strFiles<i> + "verscgoben nach " + directory + "sik//");
                        } // if
                   } catch (Exception e) {
                        String errorMessage =
                             auditStr
                                  + "Error in entpacken. Exception:"
                                  + e.getMessage();
                        Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, errorMessage);
                   } // catch
                   // *****entpacken*************
              } // for
         } //entpacke
    } // UnzipFilesBean
    class Wildcard {
         static AuditMessageKey amk = null;
         static String auditStr = "WildCard - ";
         static ModuleException mEx = null;
         private final String wildcardString;
          * Der Konstruktor für die WildcardSuche.
          * @param wildcardString
          *            Der WildcardString
         public Wildcard(String wildcardString) {
              this.wildcardString = wildcardString;
              Audit.addAuditLogEntry(
                   amk,
                   AuditLogStatus.SUCCESS,
                   auditStr + "Constructor");
          * Die Methode, welche den Vergleich durchführt.
          * @param str
          *            Der String, welcher darauf überprüft werden soll, ob er dem
          *            WildcardString entspricht.
          * @return true Wenn der String dem wildcardString entspricht.
         public boolean match(String str, boolean fCasesensitive) {
              if (str == null || wildcardString == null) {
                   return false;
              return recursiveMatch(wildcardString, str, fCasesensitive);
          * Hier wird der eigentliche Vergleich durchgeführt
          * @param strWildcard
          *            Der Wildcardstring, z.B.: "Test*"
          * @param str
          *            Der zu überprüfende String, z.B. "Testlauf"
          * @return true, wenn eine Übereinstimmung vorhanden ist, sonst false
         private boolean recursiveMatch(
              String strWildcard,
              String str,
              boolean fCasesensitive) {
              while (true) {
                   if (strWildcard.length() == 0)
                        return str.length() == 0;
                   char ch = strWildcard.charAt(0);
                   switch (ch) {
                        case '?' :
                             if (str.length() == 0)
                                  return false;
                             break;
                        case '*' :
                             strWildcard = strWildcard.substring(1);
                             while (true) {
                                  if (recursiveMatch(strWildcard, str, fCasesensitive))
                                       return true;
                                  if (str.length() == 0)
                                       return false;
                                  str = str.substring(1);
                        default :
                             if (str.length() == 0)
                                  return false;
                             if (fCasesensitive) {
                                  if (ch != str.charAt(0))
                                       return false;
                             } else if (
                                  Character.toLowerCase(ch)
                                       != Character.toLowerCase(str.charAt(0)))
                                  return false;
                             break;
                   strWildcard = strWildcard.substring(1);
                   str = str.substring(1);
         //++++++++++++++++++++++++++
    } // class
    /** Nun der eigentliche Filter */
    class MyFilter implements FilenameFilter {
         static AuditMessageKey amk = null;
         static String auditStr = "MyFilter - ";
         static ModuleException mEx = null;
         String fileMask;
         public MyFilter(String fileMask) {
              this.fileMask = fileMask;
              Audit.addAuditLogEntry(
                   amk,
                   AuditLogStatus.SUCCESS,
                   auditStr + "Constructor");
         } //constructor
          public boolean accept(File file, String filename) {
              // TODO Auto-generated method stub
              //fileMask = "?5LBL*";
              Wildcard wildcard1 = new Wildcard(fileMask);
              return wildcard1.match(filename, false);
    } //class
    But in Audit Protocol it failed after:
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - Module Configuration Key: 2
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - FileMask: ?5LBL???
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - FileMask2:
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - Directory: //transfer//X1E//100//99//lb//ein
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - SaveDirectory: //transfer//X1E//100//99//lb//ein_s
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - Funktion entpacke
    17.09.2008 17:33:19     Erfolgreich     UnzipFilesBean - f = new File(directory)
    17.09.2008 17:33:19     Fehler     UnzipFilesBean - Error bei der . Exception:null
    I could not find the error??
    Were there any log files to look into?
    regarts
    Zimmerningkat

    Hi Ralf,
    I am late..........
    I am bit confused with your explanation.
    1. Does all zip files will be picked by file adapter in one shot or is it conditional, since you have a XML descriptor file in firts zip file and the XML files describes the list of JPEG files which might be stored in the other zipped JPEG files?
    2. Can you tell the exact flow of your scenario
    3. Receiver in your scenario?
    Thanks,
    Gujjeti.

  • File adapter module

    Hello experts,
    1.
    I want to retrieve the value of <b>Target directory</b> for a file <b>reciever</b> communication channel inside module. Is it possible?  Any code samples?
    2. My audit logs are not getting printed inspite of having a log-configuration.xml in place and proper audit log statements in the code? anybody face similar situations before? These statements are inside a <b>reciever file</b> adapter module.
    Amol

    Hi Kapil,
    file.targetFileName
    In General put the following piece of code in sender or receiver adapter and u can get all the parameters specific to that Adapter Type in channel(Configuration) for outbound and inbound channel depending on direction of channel in which module is configured.
    String[] chattr=ch.getAttributeNames();// ch is channel object
    If u put this in receiver module of file adapter, the string array will hold the names of all the parameters pertaining to Receiver File Adapter(file.targetFileName,file.targetDir,etc). Same procedure holds good for sender channel.
    Once u get the parameter name, u can get the value as given by my earlier post in this thread.
    Hope this helps.
    Regards,
    Sudharshan

  • File Adapter-Module configuration

    Hi All,
    I have the following requiremnt.
    "Duplicate files should not process"
    Following are the File Access Parameters.
    Source Directory: ABC (ex: contains aa1,aa2,aa3,aa4 files)
    Filename: *
    File name mask: aa*
    My doubt is if they place aa1 file again in ftp , i should not process.
    For this I'm thinking to write module configuration.
    Can any one suggests , whether this is the correct approach? If it is could u explain how to write this module and where to write this module and how to import in xI, do i need to pass any parameter name in module configuration.
    Regards,
    venu.

    Hi Venu,
    You can go with Module in the Sender File Adapter.
    First you need to check the file name and you need to store this file name in the Database.( you can use Java Database).
    If there is an entry in the database for that file, then reject the whole file as per the business requirement. So that you can avoid , overhead of Mapping. Because if there is an error set the flag in the message and check this flag in your Receiver Determination, if it is an error send into error directory.
    Another way is outside the XI, i.e using shell scripts.
    Regards,
    Moorthy

  • ClassCastExcetion in Adapter Module

    Hi
    I have done one adapter module example which i got from SDN blogs("Step by Step guide to develop a module for reading file name in a sender file adapter" )
    All steps i have done successfully. But XI server is not picking up the file from source directory. I have checked in audit log their i got the following error
    <b>Attempt to process file failed with ClassCastException</b>
    I have checked in Adapter monitor also their i got following error
    <b>2007-05-09 12:09:05 GMT+05:30: Retry interval started. Length: 5.000 s
    - 2007-05-09 12:09:05 GMT+05:30: Error: java.lang.ClassCastException
    - 2007-05-09 12:09:05 GMT+05:30: Processing started
    - 2007-05-09 12:09:00 GMT+05:30: Error: java.lang.ClassCastException
    - 2007-05-09 12:09:00 GMT+05:30: Processing started</b>
    I have checked the JNDI names in my program and in Visual Administrator > EJB Container both are same.
    Can anyone please tell me how to resolve this problem...
    Best Regards
    Ravi Shanakar B

    Hi Joshi
    I have checked in defalut trace i got the following exception there
    <b>
    Thread is not associated with any transaction context.##
    #1.5#00111120E6DB00480000297600000EF800042FF01BB1D535#1178608210140#com.sap.engine.services.ts##com.sap.engine.services.ts#J2EE_GUEST#0##sapep.quinnox.com_QN7_9661150#Guest#a7de37e1fcff11dbcb3700111120e6db#XI AF File2XI[:MyBusinessSystem:Source_CC]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.ts.exceptions.BaseIllegalStateException: Thread is not associated with any transaction context.
         at com.sap.engine.services.ts.jta.impl.TransactionManagerImpl.rollback(TransactionManagerImpl.java:474)
         at com.sap.aii.adapter.file.File2XI.processFileList(File2XI.java:1759)
         at com.sap.aii.adapter.file.File2XI.invoke(File2XI.java:650)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:450)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    #</b>
    Best Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B

  • Adapter Module not working in Sender Communication Channel working in recie

    Hi
    I have written one adapter module. IF i give that Adapter Module in Sender Communication channel its not working. If i give that in Reciever Communication Channel its working. If i mention in both the channels then its working in sender communication channel also.But in only sender communication channel its not working in only reciever communication channel its working Can any one tell me why its happening
    Thanks & Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B
    Message was edited by:
            RaviShankar B
    Message was edited by:
            RaviShankar B

    hi
    if its problem with my code why its working if i give the adapter module in both the communication channels?If i give in only sender communication channel the module is not invoking. its not showing any auditlogs.Can any one please help me
    OUTBOUND is for sender
    INBOUND is for reciever right.?
    the following code i have written
    public ModuleData process(
              ModuleContext moduleContext,
              ModuleData inputModuleData)
              throws ModuleException {
              String SIGNATURE =
                   "process(ModuleContext moduleContext, ModuleData inputModuleData)";
              Object obj = null;
              Message msg = null;
              String filename = null;
              AuditMessageKey amk = null;
              try {
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message) obj;
                   System.out.println("&&&&&&&&&&&&&&&&&" + msg);
                   if (msg.getMessageDirection().equals(MessageDirection.OUTBOUND)){
                        amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.OUTBOUND);
                        Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> etHostName: Module called"+ i++);
                   }else{
                        File filename1 = new File("
    10.7.1.43
    XI
    source","text.txt");
                        filename1.createNewFile();
                        amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
                        Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> etHostName: Module called"+ i++);
                   System.out.println("**************" + amk + "***********");
              } catch (Exception e) {
                   Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> GetHostName: Error Module called");
                   e.printStackTrace(System.err);
                   ModuleException me = new ModuleException(e);
                   throw me;
              // Read the channel ID, channel and the module configuration
              try {
                   Hashtable mp = (Hashtable)inputModuleData.getSupplementalData("module.parameters");
                   if(mp != null){
                        filename = (String)mp.get("FileName");
                        Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"Host >>>  Element Name is set to {0}"+filename );
                   }else{               
                        Audit.addAuditLogEntry(amk,AuditLogStatus.WARNING,"HostElementName parameter is not set. Default used: HostName.");
                        filename = "FileName";
              } catch (Exception e) {
                   e.printStackTrace(System.err);
                   Audit.addAuditLogEntry(amk,AuditLogStatus.ERROR,"Cannot read the module context and configuration data");
                   ModuleException me = new ModuleException(e);
                   throw me;
              try {
                   XMLPayload xmlpayload = msg.getDocument();
                   DocumentBuilderFactory factory;
                   factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   Document document =
                        builder.parse((InputStream) xmlpayload.getInputStream());
                   Element rootNode = document.getDocumentElement();
                   if (rootNode != null) {
                        Element childElement = document.createElement("filename");
                        childElement.appendChild(document.createTextNode(filename));
                        rootNode.appendChild(childElement);
                   // Transforming the DOM object to Stream object.
                   TransformerFactory tfactory = TransformerFactory.newInstance();
                   Transformer transformer = tfactory.newTransformer();
                   Source src = new DOMSource(document);
                   ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
                   Result dest = new StreamResult(myBytes);
                   transformer.transform(src, dest);
                   byte[] docContent = myBytes.toByteArray();
                   if (docContent != null) {
                        xmlpayload.setContent(docContent);
                        inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
                   e.printStackTrace(System.err);
                   Audit.addAuditLogEntry(amk,AuditLogStatus.ERROR,"Cannot read the module context and configuration data");
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
    Best Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B
    Message was edited by:
            RaviShankar B

  • PI 7.1 adapter module issue

    I deoplyed my module and worked fine. now i changed some code by adding parameter to module
    strModuleKey = moduleContext.getContextData("module.key");
    I changed the related things in my communication channel(gave parameters)
    Now, i get below error while executing...
    java.lang.ClassCastException: class com.sap.aii.af.sdk.xi.mo.MessageContext:library:com.sap.aii.af.sdk.libcom.sap.engine.boot.loader.ResourceMultiParentClassLoader428c6e04alive incompatible with interface com.sap.engine.interfaces.messaging.api.Message:interface:com.sap.aii.af.ms.ifccom.sap.engine.boot.loader.ResourceMultiParentClassLoader2dd7e4d6alive
    Followed the below url but in vain..
    PI JAVA ADAPTER MODULE PROBLEM
    Incompatible with interface - Exception in Adapter Module
    Issue on developing Adapter Module
    Also if you are using PI 7.1 refer to the blog:
    /people/stefan.grube/blog/2008/12/11/adjust-your-pi-70-adapter-modules-for-pi-71-in-15-minutes
    Please let me know if u have any other suggestions other than this...
    Thanks
    Prabhakar

    Hi Venkat,
    Yes, you cannot add custom modules to soap adapter.
    Please refer below documentation for the same..!!
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/8c4756224a6fb5e10000000a155369/content.htm
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/69/a6fb3fea9df028e10000000a1550b0/frameset.htm
    Regards,
    Swetha.

  • Accessing a file in Imported Archive from Adapter module

    Hi,
    I am designing a module for File/FTP and Mail adapters. Is it possible to retrieve data from a CSV or TXT file uploaded in the Imported Archive from the Java code in the module? If this is possible, do I use the same approach as accessing the CSV data from the mapping using a UDF? If this is not possible, can you suggest other ways were I can access a CSV or TXT configuration file from an adapter module?
    I would like to avoid using Module key, Parameter name and Parameter value as I would like to make the adapter module generic and the data I will be reading might be too much to be specified in this location. However, I would use the Module key, Parameter name and Parameter value to specify the CSV or TXT filename which the adapter module will be using.
    Thanks in advance for any help that you can provide.
    Regards,
    Elbert

    Imported archives are part of mapping flow and adapter modules are more part of routing. Therefore I don't think imported archive could  be made accessible anywhere outside mapping.
    but my CSV or TXT file would be updated regularly by the developer.
    So were you planning to import this file again and again under imported archive? This doesn't seems to be a good solution when you think about changin Design part in Production environment. It would be better to give access to certain folder to developer to put the file there and access it using some code. You may refer this
    /people/sundararamaprasad.subbaraman/blog/2005/12/09/making-csv-file-lookup-possible-in-sap-xi
    Regards,
    Prateek

  • JMS Adapter module content conversion

    Hi,
    I'm developing a module for the jms adapter(sender). My requirement is to parse the XI message(text) using some XML parsing api and do some formatting, logic etc and to make the jms adapter create a xml file with the processed information. Jms File Content Conversion does not suit our requirement and thats the reason we are trying this option.
    My understanding is: Access the  payload in the "process" method of the local ejb, apply XML parsing using JDOM etc, make a xml which should be the output of the jms adapter. This xml will be the xml with my user defined tag elements after content conversion. Can i form this xml and assign to the inputModuleData? Will the jms adapter use this string to create the xml and send to IS? Are there any other parameters to be set or processes to be done?
    Also in which sequence should I put my adapter module in communication channel.
    ================================================
    My code snippet:
    public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
            throws ModuleException
              Object obj = null; // Handler to get Principle data
              Message msg = null; // Handler to get Message object
            try
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message)obj;
                   AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
                   Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---efore reading payload");
                   try
                        XMLPayload xmlpayload = msg.getDocument();
                        String messageStr = xmlpayload.getText();
                        String inputStr = null;
                        String tags[] = new String[2];
                        String values[] = new String[2];
                        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---before content conversion");
    String tagvalue1 = messageStr.substring(messageStr.indexOf("BEGIN+"), messageStr.indexOf("'");
    String tagvalue2 = messageStr.substring(messageStr.indexOf("'"), messageStr.lastindexOf("ENDING");
                             tags[0] = "tag1";
                             tags[1] = "tag2";
                             values[0] = tagvalue1 ;
                             values[1] = tagvalue2 ;
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---after content conversion");
                             Document xmldoc = null;
                             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                             DocumentBuilder builder = factory.newDocumentBuilder();
                             DOMImplementation impl = builder.getDOMImplementation();
                             org.w3c.dom.Element e = null;
                             Node n = null;
                             xmldoc = impl.createDocument(null, "MT940", null);
                             org.w3c.dom.Element root = xmldoc.getDocumentElement();
                             for(int i = 0; i < tags.length; i++)
                                  e = xmldoc.createElementNS(null, tags<i>);
                                  n = xmldoc.createTextNode(values<i>);
                                  e.appendChild(n);
                                  root.appendChild(e);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---before dom creation");
                             DOMSource domSource = new DOMSource(xmldoc);
                             ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
                             Result dest = new StreamResult(myBytes);                         
                             TransformerFactory tf = TransformerFactory.newInstance();
                             Transformer serializer = tf.newTransformer();
                             serializer.setOutputProperty("indent", "yes");
                             serializer.transform(domSource, dest);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---before setting principal data");
                             byte[] docContent = myBytes.toByteArray();
                             if (docContent != null) {
                             xmlpayload.setContent(docContent);
                             inputModuleData.setPrincipalData(msg);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---after setting principal data");
                   catch(ArrayIndexOutOfBoundsException e)
                        e.printStackTrace();
                   catch(StringIndexOutOfBoundsException e)
                        e.printStackTrace();
                   catch(TransformerException e)
                        e.printStackTrace();
                   catch(Exception e)
                        e.printStackTrace();
            catch(Exception e)
                ModuleException me = new ModuleException(e);
                throw me;
            return inputModuleData;

    This is for sender channel. The doubt in adapter module is in the process block how will I get the main data being read by the jms adapter from the text file.As I am reading text file from websphere MQ, the content of the text file can be obtained thru xmlpayload.getText() or is there any other way.
    obj = inputModuleData.getPrincipalData();
    msg = (Message)obj;
    XMLPayload xmlpayload = msg.getDocument();
    String messageStr = xmlpayload.getText();
    At present I am using my adapter module before call sap adapter, but before sap adapter there are two other modules(toBinary and to Xmb), so shld I place it before both or after both the modules.
    Thanx in advance
    Rachit

  • Dynamic URL creation in Adapter Module

    I have a situation in which I need to create a dynamic URL to send data using an HTTP POST ( using  HTTPS).
    I created an UDF to use Dynamic Configuration, this works fine for the UrlParam in the HTTP CC and the TServerLocation in the SOAP CC.
    My issue is that both variables have the same limitation of 200 chars max, and sometimes the URL is longer than 200 chars (I have to pass more than 20 parameters in the URL). The message mapping with the UDF fails whenever I try to put more than 200 chars in the Dynamic Configuration Variables. Therefore I cannot use Dynamic Configuration.
    I'm now thinking of creating an Adapter Module which creates an URL out of the XML message passed to the adapter, and use this value to overrule the URL defined in the Communication Channel. The URL field in the Communication Channel does not have a  200 chars limitation.
    Does anybody know how to do this? Is it possible to replace the value of the URL field in the Communication Channel with another  value in an Adapter Module?
    I have to pass the data as parameters in the URL, not as Header fields in the message.
    Thanks,
    Andre

    Hello Chris,
    The error is:
    RuntimeException during appliction Java mapping com/sap/xi/tf/_mm_paymentClusterCreate_ Thrown: com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-field mapping /ns0:mt_newPaymentClusterData/merchant_name; root message: Exception:[java.lang.IllegalArgumentException: Value is too long (471/200):
    It's even in the SAP Help:
    http://help.sap.com/saphelp_nwpi711/helpdata/en/48/ce299c3a8e5430e10000000a42189b/frameset.htm
    The length of the attribute value is defined by the XI message protocol. Values can be a maximum of 200 characters long. If, for example, you assign longer values in the mapping or adapter modules then this can lead to processing errors at runtime or the values are shortened to 200 characters. This shortening can also lead to a processing error. The processing error that occurs depends on the components that access the attributes.

  • Issue in calling Adapter Module

    Hi experts,
    We have a File -
    > IDoc scenario where the file has got fixed length data. The data is in the following format:
    Header  xdfsdfefefeswefr
    Detail    dfdkfereorierwer
    Detail    fdfkjwoeiefiwere
    Detail
    Trailer  erererewoirwoiwe
    We do not have any identifier to identify the header, detail and trailer record.
    We have gone for custom java adapter module which inserts H, D, T as the first character of each line in the file to identify the Header, Detail and Trailer nodes.
    We added a entry for calling the adapter module under the module tab in file sender communciation channel. The EAR for adapter module has been deployed successfully.
    But we are unable to call the adapter module at runtime.
    The channle log has no indication wrt to the module being called.
    We are on SAP XI 3.0 SP17
    If any one has faced a similar issue. Please respond and your help would be highly appreciated.
    regards,
    Younus

    Hi,
    Check this document.Nice document on adding an adpater module at runtime.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00838345-708c-2a10-1199-9514c0b0a91c
    this forum replies too..
    Reg Integration Scenario
    Thanks,
    Vijaya.

Maybe you are looking for

  • My computer crashed and I need to transfer songs from my ipod to a new PC

    My computer crashed and I need to transfer songs from my ipod to my new computer. This seems harder than I thought. Does anyone know how to do this?

  • Accesing java objects in a jsp.

    I've got the following problem: I have a java class that contains a connection to a jdbc database, and several functions that manipulate that database( insert ,delete,select..) I create an instance of this class in a servlet, and I need to be able to

  • SAX Qns

    the following codes will print out my whole XML document. Is there any way to print a selected item from the xml file? import javax.xml.parsers.*; import org.xml.sax.*; import org.xml.sax.helpers.*; public class Parse{      public static void main(St

  • Small question related to Unix and ABAP

    Hi Guys, I had a new SAP ABAP requirment in which they are asking for unix shell scripting. I am just wondering as what unix shell scripting has to do in SAP ? Please throw some light on this.... Regards, Tushar.

  • So You Think Your Computer's Not Powerful Enough For FCE/FCP !!!!!

    It's NOT a question - just some sobering thoughts! How many times do we get worried owners asking whether the Mac they have or the one they intend to get will have enough power to operate FCE/FCP? So I trawled through the history books - otherwise kn