Powered By

Free XML Skins for Blogger

Powered by Blogger

Friday, January 16, 2009

SAP XI Java Mapping of Adapter-Specific Message Attributes

Use

The message header of an XI message contains a header for adapter-specific message attributes that the sender adapter can use to write additional information to the message header. This enables sender adapters to write information that is not known until runtime to the message (see: Structure linkAdapter-Specific Message Attributes in the Message Header).

Furthermore, developers have read and write-to access to adapter-specific attributes from within a Java mapping program.

Integration

XSLT programs (J2EE) and message mappings have mapping runtime constants that enable developers to access the same Java classes for adapter-specific-attribute mappings as in Java mapping programs (see XSLT Mapping of Adapter-Specific Attributes or Accessing Adapter-Specific Attributes). Mapping programs executed on the Integration Server and mapping programs for the PCK runtime both support this kind of access.

There is a separate interface for ABAP mappings (see the interface documentation for the interface IF_MAPPING_DYNAMIC_CONF).

Features

The key for accessing the value of an adapter-specific attribute comprises a namespace belonging to the adapter and an attribute name. The file adapter has the following attributes, for example.

Example Attributes of the File Adapter

Adapter Namespace

Attribute Name

Attribute Value

http://sap.com/xi/XI/System/File

Directory

C:\tmp\

http://sap.com/xi/XI/System/File

FileName

test-input.xml

The adapter namespace comprises the namespace in the Integration Repository in which the adapter metadata for the adapter is saved and the name of the adapter metadata object. The adapter namespaces for the adapters shipped by SAP therefore have the following format:

http://sap.com/xi/XI/System/

The adapter metadata objects are located in the namespace http://sap.com/xi/XI/System of software component SAP BASIS.

Mapping API

The classes for accessing the adapter-specific attributes are part of the mapping API (package com.sap.aii.mapping.api):

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 attribute name.

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 more information about the mapping API in SAP NetWeaver 2004 SPS14, see SAP Developer Network at https://www.sdn.sap.com/irj/sdn/javadocs (SDN user required).

Adapter-Specific Attributes and Multi-Mappings

In multi-mappings, there are multiple message headers with adapter-specific attributes. The mapping API can only access one message header. This has the following consequences depending on whether there are multiple source or target messages:

1:n Transformation

If there are multiple target messages, the header for the adapter-specific attributes is copied for each message. This means that you can only create one header for all adapter-specific attributes, and not individual headers.

n:1 Transformation

This variant is only possible for multi-mappings in integration processes. If there is more than one source message, read-access to the adapter-specific attributes of the various message headers is not possible at runtime.

m:n Transformation

All afore-mentioned restrictions apply here. Developers can at most write the same adapter-specific attributes for all target messages to the header, without read-access to the attributes of the source messages. m:n transformations are only supported within integration processes.

No comments:

Archives