Basics of Adapter Module

Hi experts,
What is adapter Module all about ,If you can give me some Basics about this will be Helpfull.
with a simple example how to use it .
Thanks & Regards
Shakif

Hi,
While dealing with adapter modules,
1. First, create an EJB Module.
2. You create a Stateless session bean.
3. You use the following attributes for the bean,
Remote Interface: com.sap.aii.af.mp.module.ModuleRemote
Home Interface: com.sap.aii.af.mp.module.ModuleHome
Local Interface: com.sap.aii.af.mp.module.ModuleLocal
LocalHome Interface: com.sap.aii.af.mp.module.ModuleLocalHome
4. Your class must implement,
Module.process(ModuleContext, ModuleData).
5. You buiild an EAR archive and an Application Archive and then deploy this on your J2EE engine.
For async sender/receiver adapters, you use modules before the adapter module.
for sync sender/receiver adapters, you can wither use modules before the adapter module (they will affect the request message) or after the adapter module (affecting the response message).
Refer
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
SAP NetWeaver Exchange Infrastructure - Adapter Module Development - Webinar Powerpoint
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e21106cc-0c01-0010-db95-dbfc0ffd83b3
SAP Network Blog: XI: Dynamic configuration in adapter modules - one step further
/people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a
http://help.sap.com/saphelp_nw2004s/helpdata/en/a4/f13341771b4c0de10000000a1550b0/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fd/16e140a786702ae10000000a155106/content.htm
/people/siva.maranani/blog/2005/05/25/understanding-message-flow-in-xi
http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/a12241c20af16fe10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/e4/6019419efeef6fe10000000a1550b0/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/327dc490-0201-0010-d49e-e10f3e6cd3d8
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/34a1e590-0201-0010-2c82-9b6229cf4a41
thanks
swarup

Similar Messages

  • 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();

  • Accessing dynamically configured filename inside adapter module code.

    Hi,
    I am having a requirement where i have to access the filename configured using Dynamic configuration inside my receiver file adapter MODULE code.  I am having PI7.1.
    For accessing the DC filename i have inserted this piece of code inside my adapter module code:
    MessagePropertyKey MPK =new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
    String filename = msg.getMessageProperty(MPK);
    But when i am tesing this module i am getting: "Message processing failed. exception encrypting session key".
    This module is basically written for encryption.I am referring this blog:
    /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
    Do i  need to do something else for accessing DC filename inside my module??Please help??
    Thanks
    Amit

    Hi,
    My code is something like this:
    public ModuleData process(ModuleContext mc,
                   ModuleData inputModuleData)
                   throws ModuleException {
            Object obj = null;
             Message msg = null;
             MessageKey amk = null;
             String inpKeyLocation = (String) mc.getContextData("inpKeyLocation");
                try {
                  obj = inputModuleData.getPrincipalData();
                     msg = (Message) obj;
                  amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
                    XMLPayload xpld = msg.getDocument();
                  MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
                  String filename = msg.getMessageProperty(mpk);
                  InputStream inps = (InputStream) xpld.getInputStream();
                                        and so on ......
    My encryption method somewhere down the line will use "filename" as one of its input.
    Please help??
    Thanks
    Amit
    Edited by: AmitSri on May 25, 2010 1:43 PM

  • Does the 'CallSapAdapter' adapter module perform the FCC?

    Hello,
    I have a scenarion where
    Step 1 - An encrypted file has to be picked by the sender file channel
    Step 2 - It has to be decrypted (we have developed an adapter module for doing this, so no problem with that)
    Step 3 - It has to be FCC'ed (since it is a flat file) before sending it to the Integration Engine.
    To execute these 3 steps sequentially, I have configured the Sender File Channel in the following way
    Setting 1 - I have configured the necessary FCC parameters
    Setting 2 - In the 'AdapterModules' tab, I have placed my custom developed decrypter adapter module first followed by the default 'CallSapAdapter' adapter module.
    My question is, will the above setting suffice for carrying out my steps 1 - 3 in the correct order.
    Basically I need to make sure that FCC is done only after decrypting the file.
    So I need to confirm if FCC is being taken care by the 'CallSapAdapter' module.
    Can anybody help me here plese?

    Hi,
    File adapter will check the FCC function first.So you will get error that time.Because you have encrypted data.So use the "MessageTransformBean"module for FCC.
    Step 1 - An encrypted file has to be picked by the sender file channel
    Step 2 - It has to be decrypted (we have developed an adapter module for doing this, so no problem with that)
    Step 3-MessageTransformBean
    Step 4-'CallSapAdapter' adapter module
    Check the bellow link for "Message Transform Bean".
    [http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
    Regards,
    Prakasu.M

  • Regarding Adapter Module in XI..

    Guys,
    Anybody let me know the step of step procedure of implmenting custom adapter module in XI...
    So that i can implement by following steps..
    Somu.

    Hi
    Adding Wiki as well
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/write%252bpayload%252bto%252ba%252bfile%252bfrom%252badapter%252bmodule
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/change%252bpayload%252bin%252badapter%252bmodule
    These all are advance concepts.
    I think the basic adapter module guide you should try first
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e21106cc-0c01-0010-db95-dbfc0ffd83b3
    Thanks
    Gaurav

  • How to create Adapter modules

    hi experts,
    May i know how to create adapter modules..
    Thanks & Regards
    guna

    Hi,
    Start with basics:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7bf6e190-0201-0010-83b7-cc557eb76abe
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a
    Some good Examples to start with :
    Rename Attachment Adapter Module
    Copy a file with same filename using XI
    Customized Adapter Module
    Regards

  • Error in Adapter modules

    Hello Gurus,
    We are facing issue in Adapter modules installed in J2EE engine. We deployed two different Adapter modules in J2EE engine and two different interfaces are using them. But if any one of the interfaces run, the other interface is giving following error:
    "Error: BaseTransactionRolledbackLocalException: Exception thrown in method process. The transaction is marked for rollback.".
    If we restart the J2EE engine, it will start to work but the another interface is giving the smae error.
    Please help me.
    Regards,
    Indira D

    I facing the same error few days before.
    My module was working well for the first time but running again used to give problem.
    But on restarting server or redeploying module it again use to work fine.
    The basic problem was...
    there were few variables used in my modules which were initialised as class variables.
    when the process() method gets called for first time it use to execute properly.
    solution:
    Reinitialize variables at the starting phase of process() method.
    Reward points if useful.
    thanks

  • Adapter Module Filename in File Receiver Channel

    Hi All,
    is it possible to set the Filename in File Receiver Adapter from Adapter Module?
    I know that it is possible to read the data      
    Channel ch = new Channel(moduleContext.getChannelID());
    path = ch.getValueAsString("file.targetDir");
    I Need to set the filename in Adapter Module, using of Payload is not possible because Payload is not xml.
    Dynamic Parameters in Message Header is not possible because it is an multi mapping process an i need dynamic Filename for each Part
    payload after mapping is like
    MainDocument
    SubMainDocument
    MainDocument
    SubMainDocument
    i need special Name for each SubMainDocument in FileReceiverAdapter
    regards
    ralf

    Hello Stefan,
    interface mapping is an mapping  like this:
    outbound_interface => Inbound_Interface1
                                 => Inbound_Interface2
                                => Inbound_Interface3
    in sxmb_moni this looks like this
    Soap_Header
    Soap_Body
    Payloads
         =>MainDocument ( application/xml )
        => SubMainDocument ( text/xml )
         =>MainDocument ( application/xml )
        => SubMainDocument ( text/xml )
    First SubMainElement is routing to FileReceiverAdapeter A   where Filename has to be like "NameA%nr%"
    second SubMainElement is routing to FileReceiverAdapeter B   where Filename has to be like "NameB%nr%" 
    %nr% is som value from the Payload.
    Payload is not xml  because using of Conversion Argent!!
    I Think there is only one Dynamic in Header for all subelements, i have test it!
    ralf

  • Dynamic configuration required in sender file - Adapter Module

    Hi Everybody,
    I am developing an Adapter Module in the file adapter (sender) using Adapter Specific Message Attributes.
    I am using Dynamic configuration inside the Module Process method in the adapter module.
    We are getting an error saying Dynamic Configuration cannot be resolved.
    Can anybody tell me the package to be used.
    Thanks,
    Zabiulla

    You can access the dynamic configuration in adapter module like this:
    Message msg = (Message) inputModuleData.getPrincipalData();
    String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File", "FileName");
    You do not need any addition library besides the adapter module API.
    Hope that helps
    Stefan

  • ModuleData.getPrincipalData returns null in the adapter module development

    Hi gurus,
    i am doing a test on the adapter module development following an article written by William Li:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0ac06cf-6ee2-2c10-df98-e17430ca5949?QuickLink=index&overridelayout=true
    my problem is after the EJB has been deployed, it seems that the return of inputModuleData.getPrincipalData() is always null which makes the program can not get the xml payload from the framework.
    the main process of the example has been simplified like this:
         public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
              Object           obj = null;
              try {
              obj = inputModuleData.getPrincipalData();
              Message     msg1 = (Message) obj;          
                    XMLPayload xmlpayload = msg1.getDocument();}          
              catch (Exception e) {
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
    after deployed, i get the following error in the adapter monitor of RWB: (my JNDI is testtest)
    17.02.2012 17:13:44.643 Information Send binary file  "test8.xml" from FTP server "10.18.48.150:/encrypt_test/", size 206 bytes with QoS EO
    17.02.2012 17:13:44.644 Information MP: processing local module localejbs/CallSapAdapter
    17.02.2012 17:13:44.644 Information Application attempting to send an XI message asynchronously using connection File_http://sap.com/xi/XI/System
    17.02.2012 17:13:44.645 Information Trying to put the message into the send queue
    17.02.2012 17:13:44.648 Information MP: processing local module localejbs/testtest
    17.02.2012 17:13:44.648 Error MP: exception caught with cause java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.Message.getDocument() of an object loaded from local variable 'msg1'
    whereas if the code has been changed like this:
         public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
              Object           obj = null;
              try {
                   obj = inputModuleData.getPrincipalData();
                   Message     msg1 = (Message) obj;     
                   if (obj != null )
                        XMLPayload xmlpayload = msg1.getDocument();
              catch (Exception e) {
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
    the file can be read by the file adapter.
    i just quite confused that why the return of the getPrincipalData() is null? where is the problem? thanks
    Edited by: Stephen Xue on Feb 17, 2012 5:22 AM

    I'm gonna reply to myself here. I changed the processing sequence of the adapter modules in the  in the FileSender channel so that my module comes first then CallSapAdapter. Then getPrincipalData() contains the message.
    Hope this helps someone else.

  • SAP PI crashes because of Custom Adapter module

    Hi,
    We are facing a strange problem. We have deployed a custom adapter module developed in java which accesses a Hardware Security Module(HSM) and uses the keys in HSM to digitally sign our data. Now, when I use particular methods in this code and deploy it on PI server, the server crashes while testing this out. As soon as I run the channel having this adapter module, PI server becomes unavailable. It restarts on its own after a few minutes.
    One of the reasons I identified to be causing this issue is the signing mechanism used in code. When I used a mechanism that was not supported or not correct, it crashed the server. If i corrected it, it worked fine. I found no other thing in my code causing this behaviour apart from this mechanism. But I am still not able to understand how a single method in a code can cause the whole server to crash. Has anybody here faced such a problem? Any pointers would be appreciated.
    We are using SAP PI 7.31 java only installation.
    Thanks,
    Ravi Desai

    Hi Ravi
    1. To check if it is a memory issue. Once you start the channel, check the memory usage in nwa. Check if the memory is increasing once the channel is started.
    2. Add debug statements to print logs in default traces at as many places as possible. Since your code is not reaching the Catch block, using the debug statement you can reach the line in the code which is causing this issue.
    Regards
    Osman Jabri

  • Using a different user(other than default PI user) with adapter module

    Hi,
    We are having a custom adapter module built to interact with a Hardware Security Module(HSM). This custom adapter module by default uses a PI user configured in the system. However, we are not able to pass commands to HSM because of insufficient authorizations to this PI user. Now, we do not exactly know the permissions required for the user to access HSM. We have asked the HSM support team about the same. However, I wanted to explore the possibility of using a different PI user to work with the adapter module and eventually pass commands to HSM.
    We have an admin user configured which has all the necessary authorizations. Is it possible to use this admin user created on PI system to work with adapter module so that it passes commands to HSM?
    Thanks,
    Ravi Desai

    We have given the necessary authorizations to PI user.

  • How to access Payload in XI Adapter Module

    Hello,
    I have to enhance a adapter module in xi very urgently. Target is to access a node of the XML payload and retrieve the corresponding value.
    This is how my document looks like:
    <mt_test>
         <element1>
              <…> </…>
         </element1>
         <element2>
              <LOG_NO>4711 </LOG_NO>
         <element2>
    </mt_test>
    I need now access the element <LOG_NO>. This can only appear one time in the whole xml document. My code that I did so far (inside the process method) to retrieve this element is like this:
    XMLPayload xmlpayload = msg.getDocument();
         DocumentBuilderFactory factory = null;     
         factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document document = builder.parse ((InputStream)xmlpayload.getInputStream());
         Element rootNode = document.getDocumentElement();
    <…and now I have no clue anymore…:-/…>
    May you give me an example how to access the node <LOG_NO> and save the corresponding value in a String variable?
    I would be really thankful.
    Greetings and thanks in advance,
    Tobias

    Hi,
    >>>found no solution with PI Standard Import to support FTP inside the Adapter Module
    why would you? file adapter supports FTP - so you don't need it
    >>>In order to use FTP library, is there any standard library available or supported by SUN.
    you can use any java ftp client available on google
    Regards,
    Michal Krawczyk

  • Setting the charset from an adapter module

    Hi folks,
    I'm trying to set the charset encoding of a payload using an adapter module (I know there is a TextCodepageConverterBean, but I want to set the charset for a message that hasn't one yet). The problem is probably more clear using an example.
    I output a UTF-8 flat string from my message mapping to the adapter framework (mail adapter in my case). Afterwards I want to convert this UTF-8 string to an ISO-8859 encoding with the TextCodepageConverterBean. But if I set the charset using the setContentType() function of my TextPayload object the information gets cut away. I'm using the format
    setContentType("text/plain;charset=utf-8;name=Test.txt")
    . But everything after the first semicolon is dropped. Setting the charset using the MessageTransformBean works, but I want to avoid this by all means, as I need to set the mime type from the adapter module.
    This is running on NW2004 with SP 16 and the latest patch.
    Any idea, why the MessageTransformBean works and not the setContentType call?

    This bug will be fixed with SP20.
    Regards
    Stefan

  • Adapter Module Receiver File Adapter

    Hi All,
    I am getting file name in the Mapping in my target structure in a field FILENAME and i want to use this field to create a file at the target with the name as the value in FILENAME.
    I have to develop this by using Adapter Module.
    Note : This can be done by Variable Substitution and Dynamic Configuration UDF.But i want to implement the same by using adapter module.
    Can somebody help me out in getting the FILENAME from mapping inside the module process method of module.
    Thanks,
    Zabi

    Try this..
    private Map param;
    DynamicConfiguration conf = (DynamicConfiguration) param.get(
    StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String Filename = conf.get(KEY_FILENAME);[/code]
    Thanks
    Sebin

Maybe you are looking for

  • Time Machine backup not a large as amount of space used on harddrive

    I just bought a new iMAC and Time Capsule and completed my first backup. In Disk Utility it shows that there is 151 GB of space used on the hard drive. The space used on the Time Capsule is 131 GB. I searched this topic and can't find it addressed be

  • My Blackberry 9300 is asking for a MEP code

    I know the MEP code is the code to unlock your phone, but Im not trying to unlock it. I ran out of battery I charged it full and when I turned it on now is was asking for that code. It is my providers SIM card and I already tried to do the battery pu

  • I need help please if you can aid me in my quest to write this code

    I am trying really hard to accomplish this and my head hurts from trying mulitple ideas on the right code.A lottery requires that you select six different numbers from the integers 1 to 49. Write a Java program that will do this for you and generate

  • Use SD-card as ram

    I have a Mac mini fall 2012 with 4GB ram, and have heard that I can use a SD-card as Ram I know that it runs slower, but still do you know how to do it?

  • Adding audio and/or video without altering time line...

    I currently have a completed i-movie project of which I wanted to add some "stuff" at the begining of the presentation and actually at one point in the middle. I want to "insert" this audio and a few slides without altering the rest of the project. A