Adapter Module: setMessageProperty is undefined

Dear Experts,
I am developing an AdapterModule, I want to set a DynamicConfiguration parameter. I have copied a source code from this blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4623. [original link is broken] [original link is broken] [original link is broken]
But in NWDS I get an error saying "The method setMessageProperty(String, String, String) is undefined for the type Message".
All needed jars are added as External Libraries.
Does anybody have an idea how to solve this problem?
Best Regards,
Artsiom Anichenka

Hi,
In the top import statements in your program include one more import..
import com.sap.aii.af.ra.ms.api.Message;
Hope this wull help.
Nilesh

Similar Messages

  • Import  com.sap.aii.mappingtool.* show error in PI 7.1 adapter module

    Hi
    Experts,
    i have an adapter module for 7.0 and i am trying to replicate the same for PI  7.1  in 7.1 NWDS.
    i have made the required changes as mentioned in stefan's blog :/people/stefan.grube/blog/2008/12/11/adjust-your-pi-70-adapter-modules-for-pi-71-in-15-minutes
    but  import com.sap.aii.mappingtool.tf7.rt.Container; shows error , do we need to  inlcude any jar file for this :
    i am using this module to rename file name (in case of pick and place scenario forwithot IR configuration)
    getMessageProperty and setmessageProperty is getting deprecated.(striked off)
    strFileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File","FileName");
    Regards,
    Srinivas

    > strFileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File","FileName");
    in PI 7.1 you can use:
    strFileName = msg.getMessageProperty(new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File"));
    Note that property name and namspace come in different order. I almost got mad until I noticed
    http://help.sap.com/javadocs/pi/SP3/xpi/index.html

  • File To File Scenario - Receiver Channel Adapter Module

    Hello,
    We have PI 7.4 in our landscape.
    There is one File To File scenario which needs to be implemented.
    In this scenario, at source diretory we have multiple files (country wise) which needs to be read and put into mutiple folders (country wise) at the target directory.
    Please note we are not making any objects in ESR and directly configurations need to be done in Integration Directory.
    At sender side we can read mutiple files using a single Sender File adapter using the the "Advanced Selection for Source File" option.
    At receiver side we are planning to implement a custom Adapter Module which will put the files in their corresponding country wise folders.
    We are using NWDS 7.3 EHP 1 SP12 for building the adapter module.
    Suggestions are required for below mentioned points:
    1. Is the approach follwed is most suitable as we do not want to make mutiple reciever channels for each folder.
    2. How to read the file name in the receiver adapter module as Namespace will not be created (we will put a dummy namespace in ID).
    3. If any body has already implemented such logic or any suggestions for the same.
    All the suggestions are welcome and thanks in advance.
    Regards,
    Ujjwal Kumar

    Hi Ujjwal
    Yes, that is the correct namespace as long as you are using the File adapter.
    Your code is nearly there, just need the new keyword when creating a new object instance. Below is the sample
    // Get Dynamic Configuration
      MessagePropertyKey fileNameKey = new MessagePropertyKey("FileName", "http://sap.com/xi/XI/System/File");
      String fileName = msg.getMessageProperty(fileNameKey);
    // Set Dynamic Configuration
      String targetDir = "/blah/blah/blah";
      MessagePropertyKey dirKey = new MessagePropertyKey("Directory", "http://sap.com/xi/XI/System/File");
      msg.setMessageProperty(dirKey, targetDir );
    You can refer to the following SAP JavaDocs for more infomration on the Message class (which you use to get/set the property)
    Message
    Rgds
    Eng Swee

  • Issue in Adapter Module

    Hi Experts,
    I have written an Adapter module to set the target file name (because it could not be done with usual DynamicConfig in mapping because of multimapping). I am facing a peculiar issue with it. For ex: I have 3 msgs. First msg started executing the module to set the target fillename and about to end the module execution. Meanwhile second msg enters the module execution and changes the file name. This is resulting in first msg to post a file with name set by second msg. I have put "Maintain order at runtime" in interface determination of ID to fix the issue. But this isssue is still persisting. Please let me know, how can a msg acquire a lock on the module and untill it finishes it execution, no other msg should start the module execution.
    Thanks,
    Rakesh

    Hi Michal,
    I have written below code to name the \target file in module code. I have also set "Adapter specific msg attributes" in receiver file adapter and referred file name from dynamic config:
    public ModuleData process(ModuleContext inputModuleContext, ModuleData inputModuleData)
         throws ModuleException {
                   Object obj = null;
                   Message msg = null;
                   AuditAccess audit = null;
                   MessageKey keyOut = null;
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message) obj;
                   keyOut = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
                   try
                        audit = PublicAPIAccessFactory.getPublicAPIAccess().getAuditAccess();     
                        audit.addAuditLogEntry(keyOut, AuditLogStatus.SUCCESS, "Module Started Execution..");
                        MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
                        InputStream is = msg.getDocument().getInputStream();
                        DocumentBuilderFactory docBuilderFact = DocumentBuilderFactory.newInstance();
                        DocumentBuilder docBuilder      = docBuilderFact.newDocumentBuilder();
                        Document doc = docBuilder.parse(is);
                        Node nl = (Node) doc.getDocumentElement();
                        Node n = nl.getFirstChild();
                        Attr a = (Attr) n.getAttributes().item(0);
                        String Num = a.getValue();
                        audit.addAuditLogEntry(keyOut, AuditLogStatus.SUCCESS, "Number is "+Num);
                        Attr a1,a2;
                        if (n.getNodeName().equalsIgnoreCase("Create"))
                             a1 = (Attr) n.getAttributes().item(1);
                             String sd = a1.getValue();
                             audit.addAuditLogEntry(keyOut, AuditLogStatus.SUCCESS, "Start Date is "+sd);
                             String fileName = sd + "-" + Num + ".xml";
                             msg.setMessageProperty(mpk,fileName);
                        else(n.getNodeName().equalsIgnoreCase("Update"))
                             a2 = (Attr) n.getAttributes().item(2);
                             String sd = a2.getValue();
                             audit.addAuditLogEntry(keyOut, AuditLogStatus.SUCCESS, "Start Date is "+sd);
                             String fileName = sd + "-" + Num + ".xml" ;
                             msg.setMessageProperty(mpk,fileName);
                   catch(Exception e)
                        audit.addAuditLogEntry(keyOut, AuditLogStatus.ERROR, "Execption Occured.." + e);
                   return inputModuleData;
    When 3 msgs get created for Create interface, File name set by first msg is being changed by second and file for first msg is posted with name set by second (because second msg has changed the target file in module code by that time )

  • Mail Adapter Module Problem!

    Hi All
    I m facing a problem in implementing a custom mail adapter module.
    The scenario is to set the content type based on the file type. eg: if the file being sent is a pdf then content type should be "application/pdf".
    I hope the scenario is clear, please feel free to ask for clarifications.
    awaiting your replies.
    Regards
    Kapil

    Hi All
    I am able to fetch the file name now and set the content type based on the file name. But I m not able to change the name of attachment of mail. For reference, I m pasting the code here, please suggest how to do the latter part
    try {
                         // CS_GETCHADAT START
                         cid  = moduleContext.getChannelID();
                         Channel channel = new Channel(cid);
                         // Example to access a channel configuration parameter in a module: String someParameter = channel.getValueAsString("YourAttributeName");
                         // CS_GETCHADAT END
                        fileName = msgg.getMessageProperty("http://sap.com/xi/XI/System/File","FileName");
                        Payload attachment = msgg.getAttachment("MainDocument");
                             StringTokenizer st = new StringTokenizer(fileName, ".");
                             while(st.hasMoreTokens()){
                                  extension = st.nextToken();     
                        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: filename " + fileName);
                        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: extension " + extension);
                             // create new payload
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: attchmntName " + attachment.getName().toString());
                             //provide attributes and content for the new payload
                             attachment.setName("Attachment :" + fileName);
    //                         msgg.setMessageProperty("http://sap.com/xi/XI/System/File","content-description",fileName);
                             attachment.setContentType("application/" + extension );
                             inputModuleData.setPrincipalData(msgg);

  • How to read XML payload in Adapter module

    Hi all,
    I have to read content of xml payload inside custom adapter module:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_REQ xmlns:ns0="namespace">
    <record>
      <EmployeeName>a</EmployeeName>
      <EmployeeID>9999</EmployeeID>
      </record>
    <record>
      <EmployeeName>b</EmployeeName>
      <EmployeeID>9999</EmployeeID>
      </record>
    <record>
      <EmployeeName>c</EmployeeName>
      <EmployeeID>9999</EmployeeID>
      </record>
      </ns0:MT__REQ>
    obj = inputModuleData.getPrincipalData();
    msg = (Message) obj;
    XMLPayload xpld = msg.getDocument();
    String xmltxt = xpld.getText();
    InputStream in = new ByteArrayInputStream(xmltxt.getBytes("UTF-8"));
    & then using DOM parser i am trying to read the contents.
    But i am not able to read anything. And no exception is raised.
    How can i read contents of this xml file.
    Thanks,
    Mayank

    hi,
    I am still getting same Blank payload.
    My Code for Parsing is:
    doc = db.parse((InputStream) xpld.getInputStream());
    NodeList list_Set=doc.getElementsByTagName("record");
    NodeList list_Set1=doc.getElementsByTagName("EmployeeName");
    NodeList list_Set2=doc.getElementsByTagName("EmployeeID");
    Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "12");
    String input = "";
    for(int i = 0; i < list_Set.getLength(); i++){
    Node f=list_Set1.item(i);
    f=f.getFirstChild();
    String str_f=f.getNodeValue();
    Node f2=list_Set2.item(i);
    f2=f2.getFirstChild();
      String str_f2=f2.getNodeValue();
    input = input + str_f + "," + str_f2 +  "END" ;
    Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Value added from incoming payload");
    Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, input);
    And in RWB monitoring, i am able to see:
    2009-10-01 14:20:51 Information 12
    2009-10-01 14:20:51 Information UNDEFINED
    2009-10-01 14:20:51 Information 14
    So UNDEFINED is coming for input.
    Edited by: Mayank  Gupta on Oct 1, 2009 11:08 AM

  • Dynamic conifguration for adapter module

    com.sap.aii.mapping.api.DynamicConfigurationKey
    Class used to create a key object for an adapter-specific attribute. The key object comprises the adapter namespace and the property name.
    &#9679;     com.sap.aii.mapping.api.DynamicConfiguration
    Class used to read, change, or delete the value of an adapter-specific attribute. In a method, you use objects of type DynamicConfigurationKey to access the attributes

    For Module Processors, check Adapter-Specific Message Attributes of the following link:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/17/50d440e14f8431e10000000a1550b0/frameset.htm
    The methods to set/get Attributes in Adapter Module are:
    Message.setMessageProperty()
    Message.getMessageProperty()
    The following info can be obtained in javadoc:
    getMessageProperty
    public java.lang.String getMessageProperty(java.lang.String namespace,
                                               java.lang.String name)
        Returns the value of an additional message property, in case that such an value exists.
        Parameters:
            namespace - The namespace of the property to get.
            name - The name of the property to get.
        Returns:
            The value for the given namespace/name combination, or null, when no such value exists.
    setMessageProperty
    public void setMessageProperty(java.lang.String namespace,
                                   java.lang.String name,
                                   java.lang.String value)
                            throws InvalidParamException
        Sets an additional message field, if supported by the Message profile implementation. Such additional fields will not be visible as an own table column in the MS message monitoring, since it is to be stored as part of the message header. This mechanism allows different protocol implementations to support more message fiels, as per default available in the MS Message interface. Such fields can be accessed through this API method, without casting to the specific Message implementation.
        Parameters:
            namespace - The namespace of the property to set.
            name - The name of the property to set.
            value - The value of the property to set. When null is given as the value param, an already set value will be deleted.
        Throws:
            InvalidParamException - If either the length of one of the parameters is too long, or in case of an unknown/not allowed namespace/name combination (but only if the Message implementation has the necessary knowledge about the valid namespace/name pairs).
    Also, for an example, check the following blog:
    /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
    Regards,
    Henrique.

  • 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

  • Problems with Installation omwb 1.2.4.3.0 Beta

    I have installed Oracle 8i Client 8.1.5 (Oracle Universal Installer 1.6.0.7.0). I download omwb-1_2_4_3_0.exe. But I can't install the Workbench. I can choose Typical or Custom Installation and then I have following message "Der Bereitstellungsbereic

  • Extended Classic Scenario - PO Update issue

    Hello experts. We are working with SRM 5 in the extended classic scenario and we have a serious problem in a productive environment for the following case. (01) We create a purchase requisition (PR) in R/3 with several items; (02) We send PR to the S

  • Keynote files revert back to 3.0.2.

    Every time I save my keynote files they revert back to iWork '06 version (3.0.2). I've already read "Topic : Keynote 3.03 and 4.01" and it does nothing, I've tried on different files, everything. When I try to associate the file with 4.0.2 it recogni

  • IPod to my computer - computer is a PowerPC G5

    When I connect my iPod to the UBS port, it does not show up on the desk top. I want to move music from  my iPod to my computer. How can I do that?

  • Wifi passwords disappeared after update 10.10.3

    After installing the latest Yosemite patch 10.10.3, and after a subsequent restart, my wi-fi passwords all had to be re-entered on all my network settings. All worked well after I put them in again, but it was a nuisance. Did anyone else have this is