Monday, December 10, 2007

Dynamic Configuration of Some Communication Channel Parameters using Message Mapping

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:

  1. 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

  2. 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.)

  3. Use the user-function in Message Mapping:

    image

    In the mapping, the value of the element "type" from the source will be assigned to the HTTP header "DOCTYPE".

    The reason the target of the mapping is the root element is because we do not want to map this to any element, so a "" containing nothing is assigned to the root of the target.

    Incidently, the "Test" tab in Message Mapping cannot be used to test the user-function. You will get a "NULL Pointer" exception. However, you can test it using the "Test" tab in Interface Mapping.

Using the following source XML:

On the receiver HTTP application, the HTTP headers are retrieved:

The header "DOCTYPE" is assigne the value "SalesOrder".

1 comment:

Term Papers said...

I am glad to read the whole content of this blog and am very excited and happy to say that the webmaster has done a very good job here to put all the information content and information at one place, i will must refer this information with reference on my website.


Term papers

Blog Archive