Http adapter metadata in java mapping

Hi,  I'd like to read the httpheaders in my java mapping.
How can this be done?
I have tried the follwing in the execute method
       trace = (AbstractTrace)param.get(
         StreamTransformationConstants.MAPPING_TRACE);
      DynamicConfiguration dc = (DynamicConfiguration)param.get( 
          StreamTransformationConstants.DYNAMIC_CONFIGURATION);
          Object obj = (Object) param.get(
            StreamTransformationConstants.CONTENT_TYPE);
          trace.addInfo(obj.getClass().toString()); 
          // namespace http://sap.com/xi/XI/System/File
        // propertyname Directory, Filename
          trace.addInfo("Start");
          //DynamicConfigurationKey dck = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/HTTP","httpHeader");
               //trace.addInfo("has key httpHeader");
               Iterator it = dc.getKeys();
               while (it.hasNext()) {
                    DynamicConfigurationKey el = (DynamicConfigurationKey) it.next();
                    trace.addInfo(el.getNamespace() + " " + el.getName());
                    if (el.getNamespace().equals("http://sap.com/xi/XI/System/HTTP") ){
                         if (el.getName().equals("httpHeader") ){
          //if (dc.containsKey(dck)) {
          trace.addInfo("After dyn conf");
No keys are found.
Hope someone can help
Best regards /Otto

Hello, thanks for your help.
I have the following in my trace in the log SXMB_MONI
Depending on the charset and the content-type I'd like to take different action.
I use a visualbasic script to send a file to XI.
This file may be xml, zip, text or whatever. In this test I used a utf-8 text file. XI can put it into the pipe binary clean, and then I use a java program to unpack it and wrap it in xml for further processing. The file is put in the http post data, which is by definition binary clean.
Of course I can not route on a binary file, so I have to configure routing etc appropriately.
Looks like the trace api only allows for writing to the trace, not reading.
Best regards /Otto
  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--  Technical Routing
  -->
- <SAP:Trace xmlns:SAP="http://sap.com/xi/XI/Message/30">
- <Trace level="1" type="B" name="CL_HTTP_PLAIN_INBOUND">
  <Trace level="1" type="T">server-protocol HTTP/1.1</Trace>
  <Trace level="1" type="T">content-type text/plain; charset=UTF-8</Trace>
  <Trace level="1" type="T">charset charset=UTF-8</Trace>
  <Trace level="1" type="T">user-agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)</Trace>
  <Trace level="1" type="T">host skxidev:8000</Trace>
  <Trace level="1" type="T">content-length 10</Trace>
  <Trace level="1" type="T">remote-addr 10.206.97.89</Trace>
  </Trace>

Similar Messages

  • Calling IDoc structure from IDOC metadata into Java mapping.

    Hi All,
    I have a requirement where we need to post an IDOC on target side, We are having to go for  a Java Mapping ,so  I need to create a Target XML with IDOC Structure, So i need to understand if we could import the structure from IDOC Meta Data  in to the Java Mapping insted of creating the IDOC Structure, I am using DOM parser for my Java Mapping,
    Really appreciate your response in this regard.
    Best Regards
    Jayaram

    Hi Jayram,
    In your requirement, get the xsd format of the idoc from idoc structure and using String xsdFormat ="xsd retrieved";  in the java mapping, you can create the xml structure using DOM parse APIs and then you can put values into the structure and pass it.
    Thanks,
    RK

  • PI 7.1 HTTP Adapter - overwritte Prolog dynamically

    I use a HTTP Adapter to send XML Data via HTTP as form field. Therefore i use the prolog constant. Example: xmlfile=.... Now i need two new parameter (user and password) as post parameters. I can change to prolog like user=...&password=....&xmlfile=.. But in this case the prolog with the user is hard coded. in my scenaria the user and password should dynamically load from Message Mapping. The solution with the dynamic URL Parameter 1-6 could not be used, because this values are GET Parameters which are visible in der URI!
    Is there a solution for post parameters dynamically via HTTP Adapter?

    The operation mapping aka Interface mapping's need not only use 1 single mapping.
    In the interface mapping you can add multiple message mappings and / or other mapping programs.
    The mappings get executed sequentially and the output of first mapping is input to second mapping and so on.
    In this case, write a java mapping that will take the input as the output of your graphical mapping; add the prolog to this and make it the output of your Java Mapping and this is the final output of your Operation mapping!
    Regards
    Bhavesh

  • Read DataType Definition in a Java Mapping,

    Hi,
    Is there a way to load a DataType Definition and parse the fields and attribute of this data type from java code?
    I am in a custom Adapter Module (PI 7.1) and need to dynamically load the definition of a DataType to do some FCC.
    I would like to do the FCC based on the DataType definition rather then on the Communication Channel's adapter module configuration.
    Thanks,
    Martin

    Hi Martin Lavoie,
    I understand, you are getting a flat file and want to convert it into XML or the other way, converting XML to flat file in SAP PI 7.1 using File channel.
    First, why you are going for Adapter module? (I think even you don't like it) It is resource intensive to develop, running in production system, maintain. If already there is an adapter module, leave it as it is. Consider using Java mapping over adapter module. Java mapping is relatively less resource intensive to develop, running in production system, maintain. Java mapping can do the payload conversion what you are planning to do in adapter module. If you write adapter module (generic), you have to use it in interfaces (all channels) where you need to transform the payload. If you write java mapping (generic), you can use it in operational mapping in all interfaces where you need payload transformation, along with other graphical mappings.
    Second, as of now, there is no way to access Data type XSD (which are declared in ESR) using SAP PI. In PI 7.1 EHp1 payload validation using XSD can be done, by placing XSD file in folder on PI server. From PI 7.3, validation is based on Data type (XSD) defined in ESR. First place, you are interested in payload transformation not payload validation. So there is no way you can access XSD in ESR from Adapter module dynamically. I guess you can upload XSD along with adapter module, but maintenance in not all easy.
    Finally, I donu2019t recommend adapter module for you requirement. Try using FCC. You may say whenever there is change in XSD (change in field lengths), you have to change FCC (edit the channel), and I donu2019t see better option than this. If you think FCC will not be sufficient for your requirement, and then go for Java mapping. Writing generic java mapping will be a good challenge.  Java mapping should be uploaded with XSD (or parameter file) for every interface and should be edited if there is a change in XSD.
    Regards,
    K_Raghu_Vamsee
    Edited by: Raghu Vamsee on Jan 7, 2011 12:28 AM

  • RFCLookup in Java Mapping

    Hello Gurus,
    I'm performing a RFCLookUp in Java Mapping with PI 7.1 (I can't use a Message Mapping), the XML I use to do the request is:
    <n:ZHRBAPINOMINA xmlns:n="urn:sap-com:document:sap:rfc:functions">
                <PERNR>30</PERNR>
    </n:ZHRBAPINOMINA>
    The error i'm getting is:
    error while processing the request to rfc-client: com.sap.aii.adapter.rfc.afcommunication.RfcAFWException:
    error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: could not get functionname from XML requst:
    com.sap.aii.adapter.rfc.RfcAdapterException: failed to read funtionname from XML document:
    missing namespace declaration(2)
    What could cause this error?
    Thanks in advance.
    Xavi.

    Hello Raj,
    we are using a java mapping because we have to encript a pdf file with a password.
    We are calling the adapter in the java mapping, see wha we are doing:
    public static String RFCLookup( String sTabla , String sValue , String sName )
             String sAux1;
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder;
            factory.setNamespaceAware( false );
            factory.setValidating( false );
            XmlUtil xuUtil = new XmlUtil();
           try
                builder = factory.newDocumentBuilder();
            catch( Exception e )
                return "1";
            Document docReq;
            try
                // Building up RFC Request Document
                docReq = builder.newDocument();
                //Element eOutputRoot = xuUtil.createNode( docReq, "ZHRBAPINOMINA" );
                Node eOutputRoot = docReq.createElementNS("urn:sap-com:document:sap:rfc:functions", "ns:ZHRBAPINOMINA");
                //eOutputRoot.setAttribute( "xmlns:ns1" , "urn:sap-com:document:sap:rfc:functions" );
                eOutputRoot.appendChild( xuUtil.createNode( docReq , sValue , sName  ) );
                //eOutputRoot.appendChild( xuUtil.createNode( docReq , "TABLE_NAME" , sTabla ) );
                docReq.appendChild( eOutputRoot );
            catch( Exception e )
                return "2";
            // Lookup the
            Payload result;
            try
                InputStream is = new ByteArrayInputStream( docReq.toString().getBytes() );
                XmlPayload payload = LookupService.getXmlPayload( is );
                trace.addWarning("traza 1 ");
                result = accessor.call( payload );
                trace.addWarning("traza 2 ");
                if (result == null)
                     trace.addWarning("result of RFC call is null");
                     return "2.5";              
            catch( LookupException e )
                //Close accessor
                if( accessor != null )
                    try
                        accessor.close();
                    catch( LookupException ex )
                         trace.addWarning("Error during lookup1 - " + e);
                        return "3";
                trace.addWarning("Error during lookup2 - " + e);
                return "4";
            // Parsing RFC Response Document
            Document docRsp;
            try
                docRsp = builder.parse( result.getContent() );
            catch( Exception e )
                return "5";
            return "6";
            //return docRsp;
    In the execute method we are claling the RFC adapter:
    Channel channel = LookupService.getChannel( service, channelName );
    accessor = LookupService.getRfcAccessor( channel );
    We don't know why we have these errors, with old versions like XI 3.0 we didn't have errors.
    Do you know what could be?
    Many thanks.
    Xavi.

  • Java Mapping (not UDF) and Adapter-Specific Message Attributes

    Hello everybody,
    is it possible to create an Adapter-Specific Message Attributes in a java Mapping?
    I found in the SAP Help that the API com.sap.aii.mapping.api.DynamicConfiguration allows only to read, change or delete the attributes.
    best regards.
    Adnane Elgoute

    Hi,
    try the follwoing code
    import com.sap.aii.mapping.api.*;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.HashMap;
    import java.util.Map;
    public class JavaProgram
        implements StreamTransformation
        public JavaProgram()
        public void setParameter(Map map)
            param = map;
            if(param == null)
                param = new HashMap();
        public void execute(InputStream inputstream, OutputStream outputstream)
            try
                DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
                DynamicConfigurationKey dynamicconfigurationkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
                String s = dynamicconfiguration.get(dynamicconfigurationkey);
             //Your logic
            catch(Throwable throwable)
                throwable.printStackTrace();
        private Map param;

  • Read Filename form Adapter-Specific Message Attributes in Java Mapping

    Hi,
    I have scenario File to Mail adapter. How can i read filename from Adapter-Specific Message Attributes
    in java mapping.
    Thank you and Best regards
    Fernand

    Hello Fernand,
    Are u using DOM or SAX parser?
    In any case just put the Dynamic config code in the execute function or the other option is to define it as a private functionand call it in the execute,My personal advice would be the former.
    Just put this code in ur java mapping
    As fellow sdn ers have mentioned there is no need of the container method,just initialise the set param method and use it in the dynamice config code as follows
    public class YourClass implements StreamTransformation
         private Map map;
    public void setParameter(Map param)
         map = param;
    public void execute(InputStream in, OutputStream out) throws StreamTransformationException
                   DynamicConfiguration conf =(DynamicConfiguration) map.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
                   DynamicConfigurationKey KEY_FILENAME =DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    // read value
    File = conf.get(KEY_FILENAME);
    Now just call File in the mapping program,
    Should help u out 
    Regards,
    Tauseef

  • Java Mapping for HTTP Post

    Hi
    Im following this blog http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/09/12/html-form-upload-using-http-plain-adapter-with-java-mapping but I have encountered an issue which I cannot solve.
    My issue is, in addition to the required output, I am also getting unwanted XML added, which originates from the Message Type in the source Service Interface,
    i.e.
    Content-Type: multipart/form-data; boundary=--ejjeeffe1
    --ejjeeffe1
    Content-Disposition: form-data; name="event"
    Content-Type: text/plain
    Import File
    --ejjeeffe1
    Content-Disposition: form-data; name="Filename"
    Content-Type: text/plain
    TestFile.zip
    --ejjeeffe1
    Content-Disposition: form-data; name="content";filename="TestFile.zip"
    Content-Type: application/zip
    Content-Transfer-Encoding: binary
    <?xml version="1.0" encoding="UTF-8"?><__EmptyDoc></__EmptyDoc>
    --ejjeeffe1
    Any suggestions much appreciated.
    Regards
    Steve

    Hi Stephen
    The xml must be getting added in the below part of the code. It is coming from arg[0]
    You can put a check and get it removed.
    while ((len = arg0.read(buffer)) != -1) {
      arg1.write(buffer, 0, len);
    Regards
    Osman

  • How to set adapter specific message attributes on Pi 7.1 inside a Java map.

    Hello,
    how can I set adapter specific message attributes in a Java mapping on PI 7.1.? The TransformationInput grants access to the DynamicConfiguration but the TransformationOutput doesn't. I have found threads refering to the old way of implementing Java mappings (e.g. Get dynamic filename in a Java Mapping (NOT UDF)). But there doesn't seem to be one refering to the actual PI.
    Kind regards,
    Heiko

    Using DynamicConfiguration from the TransformationInput works.

  • Java Mapping of Adapter-Specific Message Attributes

    Hi!
    I've got a problem with the help.sap.com-example for the above mentioned task:
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    String valueOld = conf.get(key);
    if (valueOld != null) {
        String valueNew = valueOld.replaceAll(“input”,”output”);
        conf.put(key, valueNew);
    The Container-class I  have doesn't offer the method getTransformationParameters(). Additionally, the method get() from class DynamicConfiguration doesn't accept a DynamicConfigurationKey-object. Finally: how do I instantiate the Container-object (I think it's stored in the Parameter-Map, but what's its name?).
    Thanks!
    BR
    Christian

    Hi Christian,
    Pls see these sap help links on the Java mapping.
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm
    As you would see in the example shown in the link...you donot require a container object in case of java mapping(that is required when you are using the user defined functions)...
    here you can call the get() method from the map in the java mapping class....this map is set by the mapping runtime by calling the setParameter() method in your java mapping class.
    Thanks,
    Renjith

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

  • RFC Adapter - Java Mapping

    Hello
    is it possible to map all incoming calls from SAP -> XI (RFC) to a single Java Mapping
    in detail:
    - in SAP (ABAP) i call a number of remote function modules with the same RFC destination
    - in XI i'd like to map all these calls to a single java mapping (i think this should be possible with RFC sender adapter)
    if it is possible, maybe someone could me give me advise how to implement this in XI or some useful links
    thanks
    franz

    Hi,
    You can go for BPM.
    So you can "collect" all messages coming from Sender  in collect step.
    Then do the Transformation where you can give your java mapping.
    Regards,
    Akshay Jamgaonakr.

  • Java Mapping Or Adapter Module for MultiLevel File Content Conversion ??

    Hi Experts,
    Hi All,
    As we all know file content conversion cannot parse more than three level even if we use FCC paramenters or MessageTransform Bean /StrictXmlToPlain Bean.
    Currently i am facing an scenario where i can expect an content coversion with four or five levels.
    for ex.
    Target Message Looks like
    Header(0..1)
           |_____X
           |_____Y
           |_____Detail(0.n)
                 |____A
                 |____B
                 |____SubDetail(0.n)
                        |_____Trailer(0.n)
                                |______rec1
                                |______rec2
                                |______rec3(0..n)
                                       |______Subrec1
                                       |______Subrec2
    So my question how can i do the FixedLength/CSV in the target system ???
    Shall i do java mapping ? if yes then any code example relevant to this type of scenario
    Shall i do adapter module development ?if yes then any code example relevant to this type of scenario
    Thanks In Advance
    Ronit Mishra

    Target Message Looks like
    Header(0..1)----
    Level 1
           |_____X
           |_____Y
           |_____Detail(0.n)----
    Level 2
                 |____A
                 |____B
                 |____SubDetail(0.n)----
    Level 3
                        |_____Trailer(0.n)----
    Level 4
                                |______rec1
                                |______rec2
                                |______rec3(0..n)----
    Level 5
                                       |______Subrec1
                                       |______Subrec2

  • Java HTTP adapter in PI 7.3?

    Hi Experts,
    Anyone adivse me how to implement the java HTTP to File scenario via PI?especially explain me the HTTP sender side and how to test as well.
    thanks in advance.

    HTTP adapter now comes in AAE in Pi 7.3.  Except that there is no big difference between PI 7.3 and lower versions. You can go to component monitoring --> adapter engine --> test message and paste your payload and test. You are going to test in adapter engine level instead of abap stack (integration engine).

  • Java HTTP adapter - without Authentication

    Hello Experts,
    is it possible to set Java HTTP adapter on sender CC to request no login and password?
    I tried to look at documentation but didnt found any setting for that.
    Standard case is - when I create sender HTTP channel it requires Basic Http authorization/authentification using popup window to enter login/password.
    I`m on SAP PO 7.4
    Thank you
    vbalko

    Hi Vladimir -
    There is one blog which talks about how to disable basic authentication on soap adapter.
    I assume you can follow the same approach if you want to disable for HTTP adapter. But please note that it disables the authentication for all the channels.
    Please refer to William's reply in the below therad for more details.
    User Names and Passwords in SOAP adapter
    Path for HTTP Adapter WEB-Inf file is :
    /usr/sap/<<SID>>/DVEBMGS<<SYS_NO>>/j2ee/cluster/apps/sap.com/com.sap.aii.adapter.http.app/servlet_jsp/HttpAdapter/root/WEB-INF

Maybe you are looking for

  • How can I check manufacturers in PO?

    we have many PO in which the final suppliers, passing via vendor, traders, manufacturer and manufacturer palnts which are the real suppliers, can be more than one. Maning,  there is a manufacturer and it has many plants, part of which are allowed and

  • How do you browse transparenly with Firefox?

    We have an issue where some die hard Firefox users are having trouble getting to certain internet sites, or heck certain e-mails cause these same popups by just trying to read the message. Problem is that these individuals will get a pop up box askin

  • Consolidating multiple mini DV tapes through dubbing

    I have numerous historical family miniDV tapes captured by various family members over the years.  Most have significant timecode resets and lots of blank space at end of tape.  I was starting to capture this media into FCPX (and maybe this discussio

  • Reuse Sales Quotation in SAP Business One Addon

    I m designing an addon for SAP Business One using  VB .net 2005. I have created a menu for that Addon. Now i want to open the existing SALES QUOTATION from a sub menu of my new ADDON Menu. Please tell me if it is possible or not ? If it is possible t

  • All Firefox tabs and windows lock up when a single tab can't download a file (video, pdf, etc.)

    If I am trying to load a webpage that contains a video, pdf file, or other large file, sometimes the webpage locks up, and then ALL other Firefox windows and tabs lock up as well (the entire program is frozen). This doesn't happen with IE or Chrome (