Skip to Content
With XI 3.0 SP14, some paramters in the Integration Directory’s Communication Channel can be dynamically determined during runtime.  A couple of examples are the filename and directory used by the File Receiver Adapter.  The values for filename and directory can be obtained from the payload of the XML message.

Now, with XI 3.0 SP16, these values plus many additional ones can also be dyanmically configured using mapping programs, e.g. Message Mapping. In addition, many of these parameters are not available for dynamic configuration by using the Communication Channel as you can do with filename and directory.

For example, for an HTTP Receiver Adapter, the URL can be dynamically assigned with Message Mapping. In addition, the HTTP Header fields can also be assigned within Message Mapping.

Another benefit of using Message Mapping is that the value to be assigned does not have to be in the payload of the XML message, as what the File Receiver Communication Channel configuration requires in the case of filename and directory.

How do we determine which parameters can be assigned with a mapping program? Well, they will be listed in each of the Communication Channel configuration section, “Adapter-Speocific Message Attributes”. Once the option, “Use Adapter-Speocific Message Attributes”, is checked, all the values will be displayed.

For the discussion here, we will use the HTTP Receiver Adapter as an example. We will assign a value to the HTTP header, DOCTYPE, using Message Mapping.

Here are the steps:

  • Configure the HTTP Receiver Communication Channel.

    In the section, “Adapter-Speocific Message Attributes”, check the options: “Use Adapter-Speocific Message Attributes” and “Apply HTTP Header Fields”. Enter “DOCTYPE” in “Field 1”. This will be the HTTP header name.


image

    1. Create a user-function in Message Mapping:


image

The source code is below:

(Please note “HeaderFieldOne” is the technical name for “Field 1” in the Communication Channel configuration. The namespace used is also specific to the adapter. Please reference help.sap.com for the namespace and technical names.)

    1. Use the user-function in Message Mapping:


image


ALL_HTTP=HTTP_CONNECTION:close
HTTP_CONTENT_LENGTH:123
HTTP_CONTENT_TYPE:text/xml
HTTP_ACCEPT:/
HTTP_ACCEPT_ENCODING:gzip
HTTP_HOST:nspad391.pal.sap.corp
HTTP_USER_AGENT:SAP Web Application Server (1.0;640)
HTTP_DOCTYPE:SalesOrder


ALL_RAW=Connection: close
Content-Length: 123
Content-Type: text/xml
Accept: /
Accept-Encoding: gzip
Host: nspad391.pal.sap.corp
User-Agent: SAP Web Application Server (1.0;640)
doctype: SalesOrder


The header “DOCTYPE” is assigne the value “SalesOrder”.

To report this post you need to login first.

21 Comments

You must be Logged on to comment or reply to a post.

  1. T. van Rooyen
    Hello William,

    This means we can get rid of our XSLT mappings to insert DOCTYPE tags for outgoing http I think

    Could this also help us getting rid of the DOCTYPE header field with incoming http? So far we have had no luck getting the working xslt for this to actually work in XI as well

    Kind regards
    Tom

    (0) 
    1. William Li Post author
      Hi Tom,
      I am uncertain of your question.  Can you give an example of what you wish to do?  Is it related to an HTTP adapter, in setting HTTP header info?

      This weblog only uses DOCTYPE as an arbitrary example.  In this weblog example, DOCTYPE is an HTTP header sent to a receiving HTTP application.

      The information that can be configured during runtime depend on the adapter being used.

      Thanks,
      Bill

      (0) 
      1. T. van Rooyen
        Hello Bill

        We have a receiver HTTP which sends out a request message and receives a response. This response contains the !DOCTYPE tag.

        Before mapping the response message to its target I think the !DOCTYPE must be removed from the response message. A way to do this would be a simple XSLT mapping. But since this does not seem to work I was wondering if there might be another solution to this.

        Sorry if it is slightly off topic

        Kind regards
        Tom

        (0) 
        1. William Li Post author
          Hi Tom,
          Yes, this is slightly off the topic 🙂

          There is a method to accomplish what you want.  It will require java mapping.

          In Interface Mapping, you can assign multiple mapping steps.  Each mapping step is a mapping program, which can be Message Mapping, XSLT, Java or even ABAP.

          In your case, the 1st mapping step for the response can be a java mapping.  The java mapping program will simply edit the payload to get rid of the !DOCTYPE.  The java mapping program will read the payload exactly as is; it will not validate anything.  So, you can read the payload into a String and modify it.  The output will be sent to the 2nd mapping, which can be Message Mapping.

          Regards,
          Bill

          (0) 
          1. James Bond
            I am not able to see the input boxes for the header fields or the URL etc. This does not work for the SOAP adapter either. We are on XI 7.0 SP 7. Any idea?
            (0) 
            1. William Li Post author
              Hi,
              You should see them if you check the box, “Use Adapter-specific Message Attributes”, and then, check the box for “Apply HTTP Header Fields”.

              Regards,
              Bill

              (0) 
              1. James Bond
                In the Receiver SOAP adapter comm. channel, I am not seeing the “Apply HTTP header fields that you mention”. All I see is the “Variable Transport Binding” which when I check, I see some authorization releated fields but no check box for URL or other header fields.
                (0) 
                1. William Li Post author
                  Hi,

                  The Header fields are only available for the HTTP adapter.  Pls reference the SOAP adapter documentation in SAP Help for what is available for the SOAP adapter and their usage.

                  Regards,
                  Bill

                  (0) 
  2. Kurt Rasmussen
    Hi William, this BLOG was exactly what i needed for a customerproject. But I was not setting the header fields. Instead I wanted to dynamically set some URL parameters. (URLParamOne-URLParamThree. I used your Java coding.
    I discovered the querystring was too long (228 char). I split it up in three, created three user defined functions and transferred to different ellements in target structure.
    And voila! It worked! I can now build a very long url dynamically based on the mapping.
    However this raises some questions about limitations or max lenght on each URL parameter.
    I also discovered that URL escaping must be disabled on the communication channel. (That could be related to the target service.
    Kind regards
    Kurt
    (0) 
  3. Giovanni Maria Pace
    Hi William,
    from your experience is there any chance to do the same by script in java shell?
    For instance there is any chance to switch a communcation channel at a moment?
    I see there is possibility to switch off a service but i do not know relating a single CC.

    thanks for any suggestions

    (0) 
    1. William Li Post author
      Hi Giovanni,
      The method described in this blog cannot do what you wanted to do.

      In a near future release, there will be capability to turn off a specific CC.  I do not the exact SP level.

      As for switching a CC, there might be a work-around.  You can use a multi-mapping (1-to-many).  You can assign the source to specific target interface.  Then, using Interface Determination in the Integration Directory to assign the target interface to specific CC.

      Regards,
      Bill

      (0) 
  4. Ram Nagireddy
    Hi,

    first of all thanks for your nice blog
    conf.put(keyHeader1, a);

    you never definied variable a in the code. is this refer to target url? if so can you specify how to define the Targeturl. appreciate for your time

    (0) 
    1. William Li Post author
      The URL can be configured using the example below:

      Addressing Type:  URL Addresses
      Target Host:  nspad391.pal.sap.com
      Service Number:  80
      Path:  /saveHTTPinfo.asp

      (0) 
  5. Sridevi Gopal
    Hi Bill,
    I went through your blog and it is a great one and i was able to get the parameter through mapping .. but i have an issue that mineis a IDOC to FIle interface and im getting the Idoc number but when i use the Use Temp file name my file name is padded with MSGID which i don’t want, Is there any way to eliminate the MSG id.

    thankx,
    sri..

    (0) 
    1. William Li Post author
      Hi,
      I think by using Temp File name, it will try to make the filename unique.  Apparently, you do not have as many options.

      Can you use, write “directly”, which give you much more options?

      Regards,
      Bill

      (0) 
  6. Sumit Oberoi
    Hi,

    I am sending a Binary file and want to extract its name and send to a separate receiver(may be a web service).
    My custom code for this is below:

    public String fnExtractName(Container container){

       //write your code here

    DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters( ).get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

    DynamicConfigurationKey key = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/File“,
    “FileName”);

    String valueOld = (String)conf.get(key);

    if (valueOld != null) {
    AbstractTrace trace = container.getTrace();
    trace.addInfo(“Got the name of the file”+valueOld);
    return valueOld;
    }
    else
    return “hello”;
    }

    The problem is that I am unable to get the file name during Testing in interface mapping.

    (0) 
  7. Anoop Menon
    Hi Li,
    Thanks for this excellent blog
    but though you gave HEADERFIELD ONE:DOCTYPE
    at target its showing
    doctype:SalesOrder.
    that is its showing the header field name in smaller case rather than showing it in uppercase that you have given(ie doctype instead of DOCTYPE).
    I have a requirement which needs the same to be in uppercase.What should i do?

    ALL_HTTP=HTTP_CONNECTION:close
    HTTP_CONTENT_LENGTH:123
    HTTP_CONTENT_TYPE:text/xml
    HTTP_ACCEPT:*/*
    HTTP_ACCEPT_ENCODING:gzip
    HTTP_HOST:nspad391.pal.sap.corp
    HTTP_USER_AGENT:SAP Web Application Server (1.0;640)
    HTTP_DOCTYPE:SalesOrder

    ALL_RAW=Connection: close
    Content-Length: 123
    Content-Type: text/xml
    Accept: */*
    Accept-Encoding: gzip
    Host: nspad391.pal.sap.corp
    User-Agent: SAP Web Application Server (1.0;640)
    doctype: SalesOrder

    (0) 
  8. Nabil GUERMOUCHE
    hi, i am trying to do same kind of header customisation, but with XHeaderName1 for mail header fields like content-type, content-disposition, but it doesn’t works … Someone can help me ?
    (0) 
  9. Rafael Vieira

    Hi William.

    Does this work in PI AEX (HTTP Receiver setting URL dynamically)?

    If yes, could you give your thoughts on how to achieve such?

    Tks!

    (0) 

Leave a Reply